From dbfc7bdfa9963461a3abd872d290ddb3cb10692a Mon Sep 17 00:00:00 2001 From: lursu Date: Thu, 6 Apr 2023 15:18:04 -0400 Subject: [PATCH 01/17] added an option to NewHCPConfig() to not auto login when no local auth method are found --- auth/user.go | 13 ++++++++++++- config/hcp.go | 3 +++ config/new.go | 7 +++++++ config/with.go | 9 +++++++++ config/with_test.go | 11 +++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/auth/user.go b/auth/user.go index 0cfba9ed..10f54746 100644 --- a/auth/user.go +++ b/auth/user.go @@ -5,6 +5,7 @@ package auth import ( "context" + "errors" "fmt" "log" "time" @@ -12,9 +13,15 @@ import ( "golang.org/x/oauth2" ) +var ( + // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin + ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") +) + // UserSession implements the auth package's Session interface type UserSession struct { - browser Browser + browser Browser + NoBrowserLogin bool } // GetToken returns an access token obtained from either an existing session or new browser login. @@ -33,6 +40,10 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth // If session expiry has passed, then reauthenticate with browser login and reassign token. if readErr != nil || cache.SessionExpiry.Before(time.Now()) { + if s.NoBrowserLogin { + return nil, ErrorNoValidAuthFound + } + // Login with browser. log.Print("No credentials found, proceeding with browser login.") diff --git a/config/hcp.go b/config/hcp.go index 9861f2ae..8a61913d 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -95,6 +95,9 @@ type hcpConfig struct { // profile is the user's organization id and project id profile *profile.UserProfile + + // noBrowserLogin is an option to not automatically open browser login in no valid auth method is found. + noBrowserLogin bool } func (c *hcpConfig) Profile() *profile.UserProfile { diff --git a/config/new.go b/config/new.go index f26db213..0d366f4b 100644 --- a/config/new.go +++ b/config/new.go @@ -96,6 +96,13 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { } } + // fail out with a typed error if invoker specified WithoutBrowserLogin + if config.noBrowserLogin { + config.session = &auth.UserSession{ + NoBrowserLogin: true, + } + } + // Set up a token context with the custom auth TLS config tokenTransport := cleanhttp.DefaultPooledTransport() tokenTransport.TLSClientConfig = config.authTLSConfig diff --git a/config/with.go b/config/with.go index d7eaff41..b78962a7 100644 --- a/config/with.go +++ b/config/with.go @@ -137,3 +137,12 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { return nil } } + +// WithoutBrowserLogin disables the automatic opening of the browser login if no valid auth method is found +// instead force the return of a typed error for users to catch +func WithoutBrowserLogin() HCPConfigOption { + return func(config *hcpConfig) error { + config.noBrowserLogin = true + return nil + } +} diff --git a/config/with_test.go b/config/with_test.go index 283bcc96..b9aadfdd 100644 --- a/config/with_test.go +++ b/config/with_test.go @@ -123,3 +123,14 @@ func TestWith_Profile(t *testing.T) { require.Equal("project-id-1234", config.Profile().ProjectID) } + +func TestWithout_BrowserLogin(t *testing.T) { + require := requirepkg.New(t) + + // Exercise + config := &hcpConfig{} + require.NoError(apply(config, WithoutBrowserLogin())) + + // Ensure flag is set + require.True(config.noBrowserLogin) +} From 9e36fe8e940c59600184ea0ccd1e6dac59e6e0d6 Mon Sep 17 00:00:00 2001 From: lursu Date: Thu, 6 Apr 2023 15:21:34 -0400 Subject: [PATCH 02/17] added changelog --- .changelog/182.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/182.txt diff --git a/.changelog/182.txt b/.changelog/182.txt new file mode 100644 index 00000000..15b18e8a --- /dev/null +++ b/.changelog/182.txt @@ -0,0 +1,3 @@ +```release-note:improvement +Added option to NewHCPConfig to fail rather than auto login with web browser +``` From f07c9e27f4068369dde00e877ea6f7b92823545d Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Wed, 12 Apr 2023 08:59:30 -0400 Subject: [PATCH 03/17] Update config/with.go Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- config/with.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/with.go b/config/with.go index b78962a7..b21921cd 100644 --- a/config/with.go +++ b/config/with.go @@ -142,7 +142,7 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { // instead force the return of a typed error for users to catch func WithoutBrowserLogin() HCPConfigOption { return func(config *hcpConfig) error { - config.noBrowserLogin = true + config.oauth2Config = oauth2.Config{} return nil } } From 3e044b793e79d45d564e52e6a60248d84590075c Mon Sep 17 00:00:00 2001 From: lursu Date: Wed, 12 Apr 2023 09:16:08 -0400 Subject: [PATCH 04/17] addressed comments on pr --- auth/user.go | 11 ----------- config/hcp.go | 7 ++++--- config/new.go | 18 ++++++++++-------- config/with.go | 2 +- config/with_test.go | 4 ++-- 5 files changed, 17 insertions(+), 25 deletions(-) diff --git a/auth/user.go b/auth/user.go index 10f54746..891e2b20 100644 --- a/auth/user.go +++ b/auth/user.go @@ -5,7 +5,6 @@ package auth import ( "context" - "errors" "fmt" "log" "time" @@ -13,11 +12,6 @@ import ( "golang.org/x/oauth2" ) -var ( - // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin - ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") -) - // UserSession implements the auth package's Session interface type UserSession struct { browser Browser @@ -39,11 +33,6 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth // Check the session expiry of the retrieved token. // If session expiry has passed, then reauthenticate with browser login and reassign token. if readErr != nil || cache.SessionExpiry.Before(time.Now()) { - - if s.NoBrowserLogin { - return nil, ErrorNoValidAuthFound - } - // Login with browser. log.Print("No credentials found, proceeding with browser login.") diff --git a/config/hcp.go b/config/hcp.go index 8a61913d..28ae4350 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -14,6 +14,10 @@ import ( "golang.org/x/oauth2/clientcredentials" ) +const ( + NoOathClient = "N/A" +) + // HCPConfig provides configuration values that are useful to interact with HCP. type HCPConfig interface { @@ -95,9 +99,6 @@ type hcpConfig struct { // profile is the user's organization id and project id profile *profile.UserProfile - - // noBrowserLogin is an option to not automatically open browser login in no valid auth method is found. - noBrowserLogin bool } func (c *hcpConfig) Profile() *profile.UserProfile { diff --git a/config/new.go b/config/new.go index 0d366f4b..18072cc6 100644 --- a/config/new.go +++ b/config/new.go @@ -5,6 +5,7 @@ package config import ( "crypto/tls" + "errors" "fmt" "net/http" "net/url" @@ -17,6 +18,11 @@ import ( "golang.org/x/oauth2/clientcredentials" ) +var ( + // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin + ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") +) + const ( // defaultAuthURL is the URL of the production auth endpoint. defaultAuthURL = "https://auth.idp.hashicorp.com" @@ -96,13 +102,6 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { } } - // fail out with a typed error if invoker specified WithoutBrowserLogin - if config.noBrowserLogin { - config.session = &auth.UserSession{ - NoBrowserLogin: true, - } - } - // Set up a token context with the custom auth TLS config tokenTransport := cleanhttp.DefaultPooledTransport() tokenTransport.TLSClientConfig = config.authTLSConfig @@ -122,7 +121,7 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Create token source from the client credentials configuration. config.tokenSource = config.clientCredentialsConfig.TokenSource(tokenContext) - } else { // Set access token via browser login or use token from existing session. + } else if config.oauth2Config.ClientID != NoOathClient { // Set access token via browser login or use token from existing session. tok, err := config.session.GetToken(tokenContext, &config.oauth2Config) if err != nil { @@ -131,6 +130,9 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Update HCPConfig with most current token values. config.tokenSource = config.oauth2Config.TokenSource(tokenContext, tok) + } else { + // if the WithoutBrowserLogin option is passed in and there is no valid login already present return typed error + return nil, ErrorNoValidAuthFound } if err := config.validate(); err != nil { diff --git a/config/with.go b/config/with.go index b21921cd..a475da1c 100644 --- a/config/with.go +++ b/config/with.go @@ -142,7 +142,7 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { // instead force the return of a typed error for users to catch func WithoutBrowserLogin() HCPConfigOption { return func(config *hcpConfig) error { - config.oauth2Config = oauth2.Config{} + config.oauth2Config.ClientID = NoOathClient return nil } } diff --git a/config/with_test.go b/config/with_test.go index b9aadfdd..e3ab2133 100644 --- a/config/with_test.go +++ b/config/with_test.go @@ -131,6 +131,6 @@ func TestWithout_BrowserLogin(t *testing.T) { config := &hcpConfig{} require.NoError(apply(config, WithoutBrowserLogin())) - // Ensure flag is set - require.True(config.noBrowserLogin) + // Ensure browser login is disabled + require.Equal(NoOathClient, config.oauth2Config.ClientID) } From c1ea915ee771f1945a18b16ad74db4b8bc9e4250 Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Wed, 12 Apr 2023 11:10:13 -0400 Subject: [PATCH 05/17] Update config/hcp.go Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- config/hcp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/hcp.go b/config/hcp.go index 28ae4350..9e3f78ed 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -15,7 +15,7 @@ import ( ) const ( - NoOathClient = "N/A" + NoOAuth2Client = "N/A" ) // HCPConfig provides configuration values that are useful to interact with HCP. From ab73081b844ddc343687aa39dc5d0b3f41eb667b Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Wed, 12 Apr 2023 11:10:23 -0400 Subject: [PATCH 06/17] Update auth/user.go Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- auth/user.go | 1 - 1 file changed, 1 deletion(-) diff --git a/auth/user.go b/auth/user.go index 891e2b20..26dc1778 100644 --- a/auth/user.go +++ b/auth/user.go @@ -15,7 +15,6 @@ import ( // UserSession implements the auth package's Session interface type UserSession struct { browser Browser - NoBrowserLogin bool } // GetToken returns an access token obtained from either an existing session or new browser login. From f0959e1a48d3868f62abaf28d90b834fc3f2ab09 Mon Sep 17 00:00:00 2001 From: lursu Date: Wed, 12 Apr 2023 11:18:12 -0400 Subject: [PATCH 07/17] updated aditional locations of the new var name --- config/new.go | 2 +- config/with.go | 2 +- config/with_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/new.go b/config/new.go index 18072cc6..2e4f1085 100644 --- a/config/new.go +++ b/config/new.go @@ -121,7 +121,7 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Create token source from the client credentials configuration. config.tokenSource = config.clientCredentialsConfig.TokenSource(tokenContext) - } else if config.oauth2Config.ClientID != NoOathClient { // Set access token via browser login or use token from existing session. + } else if config.oauth2Config.ClientID != NoOAuth2Client { // Set access token via browser login or use token from existing session. tok, err := config.session.GetToken(tokenContext, &config.oauth2Config) if err != nil { diff --git a/config/with.go b/config/with.go index a475da1c..17485d1a 100644 --- a/config/with.go +++ b/config/with.go @@ -142,7 +142,7 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { // instead force the return of a typed error for users to catch func WithoutBrowserLogin() HCPConfigOption { return func(config *hcpConfig) error { - config.oauth2Config.ClientID = NoOathClient + config.oauth2Config.ClientID = NoOAuth2Client return nil } } diff --git a/config/with_test.go b/config/with_test.go index e3ab2133..b39b1476 100644 --- a/config/with_test.go +++ b/config/with_test.go @@ -132,5 +132,5 @@ func TestWithout_BrowserLogin(t *testing.T) { require.NoError(apply(config, WithoutBrowserLogin())) // Ensure browser login is disabled - require.Equal(NoOathClient, config.oauth2Config.ClientID) + require.Equal(NoOAuth2Client, config.oauth2Config.ClientID) } From 6512bbc50b8e04d7f895bbd81d0453ad7a7e4d63 Mon Sep 17 00:00:00 2001 From: lursu Date: Wed, 12 Apr 2023 11:24:58 -0400 Subject: [PATCH 08/17] fix lint issue --- auth/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/user.go b/auth/user.go index 26dc1778..b9b14722 100644 --- a/auth/user.go +++ b/auth/user.go @@ -14,7 +14,7 @@ import ( // UserSession implements the auth package's Session interface type UserSession struct { - browser Browser + browser Browser } // GetToken returns an access token obtained from either an existing session or new browser login. From 6939df035ed90624c2e52b301cd874051cc19eb2 Mon Sep 17 00:00:00 2001 From: lursu Date: Mon, 17 Apr 2023 09:11:56 -0400 Subject: [PATCH 09/17] git revert --- auth/user.go | 14 +- .../delete_sentinel_policy_parameters.go | 213 ---------- .../delete_sentinel_policy_responses.go | 178 -------- .../deregister_linked_cluster_parameters.go | 247 ++++++++--- .../deregister_linked_cluster_responses.go | 16 +- .../get_available_templates_parameters.go | 241 ----------- .../get_available_templates_responses.go | 178 -------- .../get_linked_cluster_policy_parameters.go | 272 +++++++++++++ .../get_linked_cluster_policy_responses.go | 178 ++++++++ .../is_vault_plugin_registered_parameters.go | 213 ---------- .../is_vault_plugin_registered_responses.go | 178 -------- .../list_all_clusters_parameters.go | 384 ------------------ .../list_all_clusters_responses.go | 178 -------- .../list_snapshots_parameters.go | 43 +- .../client/vault_service/lock_parameters.go | 213 ---------- .../client/vault_service/lock_responses.go | 178 -------- .../revoke_admin_tokens_parameters.go | 213 ---------- .../revoke_admin_tokens_responses.go | 176 -------- .../client/vault_service/unlock_parameters.go | 213 ---------- .../client/vault_service/unlock_responses.go | 178 -------- .../vault_service/vault_service_client.go | 312 ++------------ .../hashicorp_cloud_internal_location_link.go | 129 ------ ...hicorp_cloud_internal_location_location.go | 111 ----- ...ashicorp_cloud_internal_location_region.go | 53 --- ...hashicorp_cloud_vault20201125_audit_log.go | 3 +- .../hashicorp_cloud_vault20201125_cluster.go | 3 +- ...corp_cloud_vault20201125_cluster_config.go | 46 --- ...25_cluster_performance_replication_info.go | 3 +- ...icorp_cloud_vault20201125_cluster_state.go | 20 +- ...d_vault20201125_create_snapshot_request.go | 3 +- ...20201125_delete_sentinel_policy_request.go | 116 ------ ...0201125_delete_sentinel_policy_response.go | 105 ----- ...1125_deregister_linked_cluster_response.go | 96 +---- ...d_vault20201125_fetch_audit_log_request.go | 3 +- ...201125_get_available_templates_response.go | 116 ------ ...t_available_templates_response_template.go | 56 --- ...1125_get_linked_cluster_policy_response.go | 50 +++ ...icorp_cloud_vault20201125_input_cluster.go | 5 +- ...loud_vault20201125_input_cluster_config.go | 46 --- ...ult20201125_input_vault_insights_config.go | 50 --- ...1125_is_vault_plugin_registered_request.go | 116 ------ ...125_is_vault_plugin_registered_response.go | 50 --- ...corp_cloud_vault20201125_linked_cluster.go | 144 +------ ...cloud_vault20201125_linked_cluster_node.go | 293 ------------- ...01125_linked_cluster_node_leader_status.go | 91 ----- ...t20201125_linked_cluster_node_log_level.go | 90 ---- ...vault20201125_linked_cluster_node_state.go | 87 ---- ...1125_linked_cluster_node_version_status.go | 90 ---- ...loud_vault20201125_linked_cluster_state.go | 5 +- ...ault20201125_list_all_clusters_response.go | 163 -------- ...ist_all_clusters_response_vault_cluster.go | 150 ------- ...hicorp_cloud_vault20201125_lock_request.go | 107 ----- ...icorp_cloud_vault20201125_lock_response.go | 105 ----- ..._cloud_vault20201125_raft_quorum_status.go | 56 --- ...20201125_recreate_from_snapshot_request.go | 3 +- ...0201125_register_linked_cluster_request.go | 3 +- ...201125_register_linked_cluster_response.go | 3 - ..._vault20201125_restore_snapshot_request.go | 3 +- ...ult20201125_revoke_admin_tokens_request.go | 107 ----- ...lt20201125_revoke_admin_tokens_response.go | 11 - ...hicorp_cloud_vault20201125_seal_request.go | 3 +- .../hashicorp_cloud_vault20201125_snapshot.go | 6 +- ...corp_cloud_vault20201125_unlock_request.go | 107 ----- ...orp_cloud_vault20201125_unlock_response.go | 105 ----- ...corp_cloud_vault20201125_unseal_request.go | 3 +- ...t20201125_update_c_o_r_s_config_request.go | 3 +- ...te_major_version_upgrade_config_request.go | 3 +- ...ult20201125_update_paths_filter_request.go | 3 +- ...vault20201125_update_public_ips_request.go | 3 +- ...ud_vault20201125_update_version_request.go | 3 +- ...t20201125_upgrade_major_version_request.go | 3 +- ...oud_vault20201125_vault_insights_config.go | 77 ---- config/hcp.go | 7 +- config/new.go | 18 +- config/with.go | 2 +- config/with_test.go | 4 +- 76 files changed, 807 insertions(+), 6250 deletions(-) delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go diff --git a/auth/user.go b/auth/user.go index b9b14722..10f54746 100644 --- a/auth/user.go +++ b/auth/user.go @@ -5,6 +5,7 @@ package auth import ( "context" + "errors" "fmt" "log" "time" @@ -12,9 +13,15 @@ import ( "golang.org/x/oauth2" ) +var ( + // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin + ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") +) + // UserSession implements the auth package's Session interface type UserSession struct { - browser Browser + browser Browser + NoBrowserLogin bool } // GetToken returns an access token obtained from either an existing session or new browser login. @@ -32,6 +39,11 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth // Check the session expiry of the retrieved token. // If session expiry has passed, then reauthenticate with browser login and reassign token. if readErr != nil || cache.SessionExpiry.Before(time.Now()) { + + if s.NoBrowserLogin { + return nil, ErrorNoValidAuthFound + } + // Login with browser. log.Print("No credentials found, proceeding with browser login.") diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go deleted file mode 100644 index 5f2c7e0d..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// NewDeleteSentinelPolicyParams creates a new DeleteSentinelPolicyParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteSentinelPolicyParams() *DeleteSentinelPolicyParams { - return &DeleteSentinelPolicyParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteSentinelPolicyParamsWithTimeout creates a new DeleteSentinelPolicyParams object -// with the ability to set a timeout on a request. -func NewDeleteSentinelPolicyParamsWithTimeout(timeout time.Duration) *DeleteSentinelPolicyParams { - return &DeleteSentinelPolicyParams{ - timeout: timeout, - } -} - -// NewDeleteSentinelPolicyParamsWithContext creates a new DeleteSentinelPolicyParams object -// with the ability to set a context for a request. -func NewDeleteSentinelPolicyParamsWithContext(ctx context.Context) *DeleteSentinelPolicyParams { - return &DeleteSentinelPolicyParams{ - Context: ctx, - } -} - -// NewDeleteSentinelPolicyParamsWithHTTPClient creates a new DeleteSentinelPolicyParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteSentinelPolicyParamsWithHTTPClient(client *http.Client) *DeleteSentinelPolicyParams { - return &DeleteSentinelPolicyParams{ - HTTPClient: client, - } -} - -/* -DeleteSentinelPolicyParams contains all the parameters to send to the API endpoint - - for the delete sentinel policy operation. - - Typically these are written to a http.Request. -*/ -type DeleteSentinelPolicyParams struct { - - // Body. - Body *models.HashicorpCloudVault20201125DeleteSentinelPolicyRequest - - // ClusterID. - ClusterID string - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete sentinel policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteSentinelPolicyParams) WithDefaults() *DeleteSentinelPolicyParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete sentinel policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteSentinelPolicyParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithTimeout(timeout time.Duration) *DeleteSentinelPolicyParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithContext(ctx context.Context) *DeleteSentinelPolicyParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithHTTPClient(client *http.Client) *DeleteSentinelPolicyParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithBody(body *models.HashicorpCloudVault20201125DeleteSentinelPolicyRequest) *DeleteSentinelPolicyParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetBody(body *models.HashicorpCloudVault20201125DeleteSentinelPolicyRequest) { - o.Body = body -} - -// WithClusterID adds the clusterID to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithClusterID(clusterID string) *DeleteSentinelPolicyParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WithLocationOrganizationID adds the locationOrganizationID to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithLocationOrganizationID(locationOrganizationID string) *DeleteSentinelPolicyParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) WithLocationProjectID(locationProjectID string) *DeleteSentinelPolicyParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the delete sentinel policy params -func (o *DeleteSentinelPolicyParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteSentinelPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go deleted file mode 100644 index 2b53a1a1..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// DeleteSentinelPolicyReader is a Reader for the DeleteSentinelPolicy structure. -type DeleteSentinelPolicyReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteSentinelPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteSentinelPolicyOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewDeleteSentinelPolicyDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewDeleteSentinelPolicyOK creates a DeleteSentinelPolicyOK with default headers values -func NewDeleteSentinelPolicyOK() *DeleteSentinelPolicyOK { - return &DeleteSentinelPolicyOK{} -} - -/* -DeleteSentinelPolicyOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type DeleteSentinelPolicyOK struct { - Payload *models.HashicorpCloudVault20201125DeleteSentinelPolicyResponse -} - -// IsSuccess returns true when this delete sentinel policy o k response has a 2xx status code -func (o *DeleteSentinelPolicyOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete sentinel policy o k response has a 3xx status code -func (o *DeleteSentinelPolicyOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete sentinel policy o k response has a 4xx status code -func (o *DeleteSentinelPolicyOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete sentinel policy o k response has a 5xx status code -func (o *DeleteSentinelPolicyOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete sentinel policy o k response a status code equal to that given -func (o *DeleteSentinelPolicyOK) IsCode(code int) bool { - return code == 200 -} - -func (o *DeleteSentinelPolicyOK) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] deleteSentinelPolicyOK %+v", 200, o.Payload) -} - -func (o *DeleteSentinelPolicyOK) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] deleteSentinelPolicyOK %+v", 200, o.Payload) -} - -func (o *DeleteSentinelPolicyOK) GetPayload() *models.HashicorpCloudVault20201125DeleteSentinelPolicyResponse { - return o.Payload -} - -func (o *DeleteSentinelPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125DeleteSentinelPolicyResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteSentinelPolicyDefault creates a DeleteSentinelPolicyDefault with default headers values -func NewDeleteSentinelPolicyDefault(code int) *DeleteSentinelPolicyDefault { - return &DeleteSentinelPolicyDefault{ - _statusCode: code, - } -} - -/* -DeleteSentinelPolicyDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type DeleteSentinelPolicyDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the delete sentinel policy default response -func (o *DeleteSentinelPolicyDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this delete sentinel policy default response has a 2xx status code -func (o *DeleteSentinelPolicyDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this delete sentinel policy default response has a 3xx status code -func (o *DeleteSentinelPolicyDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this delete sentinel policy default response has a 4xx status code -func (o *DeleteSentinelPolicyDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this delete sentinel policy default response has a 5xx status code -func (o *DeleteSentinelPolicyDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this delete sentinel policy default response a status code equal to that given -func (o *DeleteSentinelPolicyDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *DeleteSentinelPolicyDefault) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] DeleteSentinelPolicy default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteSentinelPolicyDefault) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] DeleteSentinelPolicy default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteSentinelPolicyDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *DeleteSentinelPolicyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go index 52d817ab..e666da4c 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go @@ -61,32 +61,57 @@ DeregisterLinkedClusterParams contains all the parameters to send to the API end */ type DeregisterLinkedClusterParams struct { - // ClusterID. - ClusterID string + /* ClusterLinkDescription. - /* LocationOrganizationID. + description is a human-friendly description for this link. This is + used primarily for informational purposes such as error messages. + */ + ClusterLinkDescription *string + + /* ClusterLinkID. + + id is the identifier for this resource. + */ + ClusterLinkID *string + + /* ClusterLinkLocationOrganizationID. organization_id is the id of the organization. */ - LocationOrganizationID string + ClusterLinkLocationOrganizationID string - /* LocationProjectID. + /* ClusterLinkLocationProjectID. project_id is the projects id. */ - LocationProjectID string + ClusterLinkLocationProjectID string - /* LocationRegionProvider. + /* ClusterLinkLocationRegionProvider. provider is the named cloud provider ("aws", "gcp", "azure"). */ - LocationRegionProvider *string + ClusterLinkLocationRegionProvider *string - /* LocationRegionRegion. + /* ClusterLinkLocationRegionRegion. region is the cloud region ("us-west1", "us-east1"). */ - LocationRegionRegion *string + ClusterLinkLocationRegionRegion *string + + /* ClusterLinkType. + + type is the unique type of the resource. Each service publishes a + unique set of types. The type value is recommended to be formatted + in "." such as "hashicorp.hvn". This is to prevent conflicts + in the future, but any string value will work. + */ + ClusterLinkType *string + + /* ClusterLinkUUID. + + uuid is the unique UUID for this resource. + */ + ClusterLinkUUID *string timeout time.Duration Context context.Context @@ -141,59 +166,92 @@ func (o *DeregisterLinkedClusterParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithClusterID adds the clusterID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterID(clusterID string) *DeregisterLinkedClusterParams { - o.SetClusterID(clusterID) +// WithClusterLinkDescription adds the clusterLinkDescription to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkDescription(clusterLinkDescription *string) *DeregisterLinkedClusterParams { + o.SetClusterLinkDescription(clusterLinkDescription) + return o +} + +// SetClusterLinkDescription adds the clusterLinkDescription to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkDescription(clusterLinkDescription *string) { + o.ClusterLinkDescription = clusterLinkDescription +} + +// WithClusterLinkID adds the clusterLinkID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkID(clusterLinkID *string) *DeregisterLinkedClusterParams { + o.SetClusterLinkID(clusterLinkID) return o } -// SetClusterID adds the clusterId to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID +// SetClusterLinkID adds the clusterLinkId to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkID(clusterLinkID *string) { + o.ClusterLinkID = clusterLinkID } -// WithLocationOrganizationID adds the locationOrganizationID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithLocationOrganizationID(locationOrganizationID string) *DeregisterLinkedClusterParams { - o.SetLocationOrganizationID(locationOrganizationID) +// WithClusterLinkLocationOrganizationID adds the clusterLinkLocationOrganizationID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationOrganizationID(clusterLinkLocationOrganizationID string) *DeregisterLinkedClusterParams { + o.SetClusterLinkLocationOrganizationID(clusterLinkLocationOrganizationID) return o } -// SetLocationOrganizationID adds the locationOrganizationId to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID +// SetClusterLinkLocationOrganizationID adds the clusterLinkLocationOrganizationId to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationOrganizationID(clusterLinkLocationOrganizationID string) { + o.ClusterLinkLocationOrganizationID = clusterLinkLocationOrganizationID } -// WithLocationProjectID adds the locationProjectID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithLocationProjectID(locationProjectID string) *DeregisterLinkedClusterParams { - o.SetLocationProjectID(locationProjectID) +// WithClusterLinkLocationProjectID adds the clusterLinkLocationProjectID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationProjectID(clusterLinkLocationProjectID string) *DeregisterLinkedClusterParams { + o.SetClusterLinkLocationProjectID(clusterLinkLocationProjectID) return o } -// SetLocationProjectID adds the locationProjectId to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID +// SetClusterLinkLocationProjectID adds the clusterLinkLocationProjectId to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationProjectID(clusterLinkLocationProjectID string) { + o.ClusterLinkLocationProjectID = clusterLinkLocationProjectID } -// WithLocationRegionProvider adds the locationRegionProvider to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithLocationRegionProvider(locationRegionProvider *string) *DeregisterLinkedClusterParams { - o.SetLocationRegionProvider(locationRegionProvider) +// WithClusterLinkLocationRegionProvider adds the clusterLinkLocationRegionProvider to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationRegionProvider(clusterLinkLocationRegionProvider *string) *DeregisterLinkedClusterParams { + o.SetClusterLinkLocationRegionProvider(clusterLinkLocationRegionProvider) return o } -// SetLocationRegionProvider adds the locationRegionProvider to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetLocationRegionProvider(locationRegionProvider *string) { - o.LocationRegionProvider = locationRegionProvider +// SetClusterLinkLocationRegionProvider adds the clusterLinkLocationRegionProvider to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationRegionProvider(clusterLinkLocationRegionProvider *string) { + o.ClusterLinkLocationRegionProvider = clusterLinkLocationRegionProvider } -// WithLocationRegionRegion adds the locationRegionRegion to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithLocationRegionRegion(locationRegionRegion *string) *DeregisterLinkedClusterParams { - o.SetLocationRegionRegion(locationRegionRegion) +// WithClusterLinkLocationRegionRegion adds the clusterLinkLocationRegionRegion to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationRegionRegion(clusterLinkLocationRegionRegion *string) *DeregisterLinkedClusterParams { + o.SetClusterLinkLocationRegionRegion(clusterLinkLocationRegionRegion) return o } -// SetLocationRegionRegion adds the locationRegionRegion to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetLocationRegionRegion(locationRegionRegion *string) { - o.LocationRegionRegion = locationRegionRegion +// SetClusterLinkLocationRegionRegion adds the clusterLinkLocationRegionRegion to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationRegionRegion(clusterLinkLocationRegionRegion *string) { + o.ClusterLinkLocationRegionRegion = clusterLinkLocationRegionRegion +} + +// WithClusterLinkType adds the clusterLinkType to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkType(clusterLinkType *string) *DeregisterLinkedClusterParams { + o.SetClusterLinkType(clusterLinkType) + return o +} + +// SetClusterLinkType adds the clusterLinkType to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkType(clusterLinkType *string) { + o.ClusterLinkType = clusterLinkType +} + +// WithClusterLinkUUID adds the clusterLinkUUID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterLinkUUID(clusterLinkUUID *string) *DeregisterLinkedClusterParams { + o.SetClusterLinkUUID(clusterLinkUUID) + return o +} + +// SetClusterLinkUUID adds the clusterLinkUuid to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterLinkUUID(clusterLinkUUID *string) { + o.ClusterLinkUUID = clusterLinkUUID } // WriteToRequest writes these params to a swagger request @@ -204,50 +262,113 @@ func (o *DeregisterLinkedClusterParams) WriteToRequest(r runtime.ClientRequest, } var res []error - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err + if o.ClusterLinkDescription != nil { + + // query param cluster_link.description + var qrClusterLinkDescription string + + if o.ClusterLinkDescription != nil { + qrClusterLinkDescription = *o.ClusterLinkDescription + } + qClusterLinkDescription := qrClusterLinkDescription + if qClusterLinkDescription != "" { + + if err := r.SetQueryParam("cluster_link.description", qClusterLinkDescription); err != nil { + return err + } + } } - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + if o.ClusterLinkID != nil { + + // query param cluster_link.id + var qrClusterLinkID string + + if o.ClusterLinkID != nil { + qrClusterLinkID = *o.ClusterLinkID + } + qClusterLinkID := qrClusterLinkID + if qClusterLinkID != "" { + + if err := r.SetQueryParam("cluster_link.id", qClusterLinkID); err != nil { + return err + } + } + } + + // path param cluster_link.location.organization_id + if err := r.SetPathParam("cluster_link.location.organization_id", o.ClusterLinkLocationOrganizationID); err != nil { return err } - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + // path param cluster_link.location.project_id + if err := r.SetPathParam("cluster_link.location.project_id", o.ClusterLinkLocationProjectID); err != nil { return err } - if o.LocationRegionProvider != nil { + if o.ClusterLinkLocationRegionProvider != nil { + + // query param cluster_link.location.region.provider + var qrClusterLinkLocationRegionProvider string + + if o.ClusterLinkLocationRegionProvider != nil { + qrClusterLinkLocationRegionProvider = *o.ClusterLinkLocationRegionProvider + } + qClusterLinkLocationRegionProvider := qrClusterLinkLocationRegionProvider + if qClusterLinkLocationRegionProvider != "" { + + if err := r.SetQueryParam("cluster_link.location.region.provider", qClusterLinkLocationRegionProvider); err != nil { + return err + } + } + } + + if o.ClusterLinkLocationRegionRegion != nil { + + // query param cluster_link.location.region.region + var qrClusterLinkLocationRegionRegion string + + if o.ClusterLinkLocationRegionRegion != nil { + qrClusterLinkLocationRegionRegion = *o.ClusterLinkLocationRegionRegion + } + qClusterLinkLocationRegionRegion := qrClusterLinkLocationRegionRegion + if qClusterLinkLocationRegionRegion != "" { + + if err := r.SetQueryParam("cluster_link.location.region.region", qClusterLinkLocationRegionRegion); err != nil { + return err + } + } + } + + if o.ClusterLinkType != nil { - // query param location.region.provider - var qrLocationRegionProvider string + // query param cluster_link.type + var qrClusterLinkType string - if o.LocationRegionProvider != nil { - qrLocationRegionProvider = *o.LocationRegionProvider + if o.ClusterLinkType != nil { + qrClusterLinkType = *o.ClusterLinkType } - qLocationRegionProvider := qrLocationRegionProvider - if qLocationRegionProvider != "" { + qClusterLinkType := qrClusterLinkType + if qClusterLinkType != "" { - if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + if err := r.SetQueryParam("cluster_link.type", qClusterLinkType); err != nil { return err } } } - if o.LocationRegionRegion != nil { + if o.ClusterLinkUUID != nil { - // query param location.region.region - var qrLocationRegionRegion string + // query param cluster_link.uuid + var qrClusterLinkUUID string - if o.LocationRegionRegion != nil { - qrLocationRegionRegion = *o.LocationRegionRegion + if o.ClusterLinkUUID != nil { + qrClusterLinkUUID = *o.ClusterLinkUUID } - qLocationRegionRegion := qrLocationRegionRegion - if qLocationRegionRegion != "" { + qClusterLinkUUID := qrClusterLinkUUID + if qClusterLinkUUID != "" { - if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + if err := r.SetQueryParam("cluster_link.uuid", qClusterLinkUUID); err != nil { return err } } diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go index 0c05e66e..794628a1 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go @@ -53,7 +53,7 @@ DeregisterLinkedClusterOK describes a response with status code 200, with defaul A successful response. */ type DeregisterLinkedClusterOK struct { - Payload *models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse + Payload models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse } // IsSuccess returns true when this deregister linked cluster o k response has a 2xx status code @@ -82,23 +82,21 @@ func (o *DeregisterLinkedClusterOK) IsCode(code int) bool { } func (o *DeregisterLinkedClusterOK) Error() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) } func (o *DeregisterLinkedClusterOK) String() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) } -func (o *DeregisterLinkedClusterOK) GetPayload() *models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse { +func (o *DeregisterLinkedClusterOK) GetPayload() models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse { return o.Payload } func (o *DeregisterLinkedClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - o.Payload = new(models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse) - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { return err } @@ -154,11 +152,11 @@ func (o *DeregisterLinkedClusterDefault) IsCode(code int) bool { } func (o *DeregisterLinkedClusterDefault) Error() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) } func (o *DeregisterLinkedClusterDefault) String() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) } func (o *DeregisterLinkedClusterDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go deleted file mode 100644 index 4ee1ffdd..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go +++ /dev/null @@ -1,241 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetAvailableTemplatesParams creates a new GetAvailableTemplatesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetAvailableTemplatesParams() *GetAvailableTemplatesParams { - return &GetAvailableTemplatesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetAvailableTemplatesParamsWithTimeout creates a new GetAvailableTemplatesParams object -// with the ability to set a timeout on a request. -func NewGetAvailableTemplatesParamsWithTimeout(timeout time.Duration) *GetAvailableTemplatesParams { - return &GetAvailableTemplatesParams{ - timeout: timeout, - } -} - -// NewGetAvailableTemplatesParamsWithContext creates a new GetAvailableTemplatesParams object -// with the ability to set a context for a request. -func NewGetAvailableTemplatesParamsWithContext(ctx context.Context) *GetAvailableTemplatesParams { - return &GetAvailableTemplatesParams{ - Context: ctx, - } -} - -// NewGetAvailableTemplatesParamsWithHTTPClient creates a new GetAvailableTemplatesParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetAvailableTemplatesParamsWithHTTPClient(client *http.Client) *GetAvailableTemplatesParams { - return &GetAvailableTemplatesParams{ - HTTPClient: client, - } -} - -/* -GetAvailableTemplatesParams contains all the parameters to send to the API endpoint - - for the get available templates operation. - - Typically these are written to a http.Request. -*/ -type GetAvailableTemplatesParams struct { - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - /* LocationRegionProvider. - - provider is the named cloud provider ("aws", "gcp", "azure"). - */ - LocationRegionProvider *string - - /* LocationRegionRegion. - - region is the cloud region ("us-west1", "us-east1"). - */ - LocationRegionRegion *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get available templates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetAvailableTemplatesParams) WithDefaults() *GetAvailableTemplatesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get available templates params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetAvailableTemplatesParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get available templates params -func (o *GetAvailableTemplatesParams) WithTimeout(timeout time.Duration) *GetAvailableTemplatesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get available templates params -func (o *GetAvailableTemplatesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get available templates params -func (o *GetAvailableTemplatesParams) WithContext(ctx context.Context) *GetAvailableTemplatesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get available templates params -func (o *GetAvailableTemplatesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get available templates params -func (o *GetAvailableTemplatesParams) WithHTTPClient(client *http.Client) *GetAvailableTemplatesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get available templates params -func (o *GetAvailableTemplatesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithLocationOrganizationID adds the locationOrganizationID to the get available templates params -func (o *GetAvailableTemplatesParams) WithLocationOrganizationID(locationOrganizationID string) *GetAvailableTemplatesParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the get available templates params -func (o *GetAvailableTemplatesParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the get available templates params -func (o *GetAvailableTemplatesParams) WithLocationProjectID(locationProjectID string) *GetAvailableTemplatesParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the get available templates params -func (o *GetAvailableTemplatesParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WithLocationRegionProvider adds the locationRegionProvider to the get available templates params -func (o *GetAvailableTemplatesParams) WithLocationRegionProvider(locationRegionProvider *string) *GetAvailableTemplatesParams { - o.SetLocationRegionProvider(locationRegionProvider) - return o -} - -// SetLocationRegionProvider adds the locationRegionProvider to the get available templates params -func (o *GetAvailableTemplatesParams) SetLocationRegionProvider(locationRegionProvider *string) { - o.LocationRegionProvider = locationRegionProvider -} - -// WithLocationRegionRegion adds the locationRegionRegion to the get available templates params -func (o *GetAvailableTemplatesParams) WithLocationRegionRegion(locationRegionRegion *string) *GetAvailableTemplatesParams { - o.SetLocationRegionRegion(locationRegionRegion) - return o -} - -// SetLocationRegionRegion adds the locationRegionRegion to the get available templates params -func (o *GetAvailableTemplatesParams) SetLocationRegionRegion(locationRegionRegion *string) { - o.LocationRegionRegion = locationRegionRegion -} - -// WriteToRequest writes these params to a swagger request -func (o *GetAvailableTemplatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if o.LocationRegionProvider != nil { - - // query param location.region.provider - var qrLocationRegionProvider string - - if o.LocationRegionProvider != nil { - qrLocationRegionProvider = *o.LocationRegionProvider - } - qLocationRegionProvider := qrLocationRegionProvider - if qLocationRegionProvider != "" { - - if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { - return err - } - } - } - - if o.LocationRegionRegion != nil { - - // query param location.region.region - var qrLocationRegionRegion string - - if o.LocationRegionRegion != nil { - qrLocationRegionRegion = *o.LocationRegionRegion - } - qLocationRegionRegion := qrLocationRegionRegion - if qLocationRegionRegion != "" { - - if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go deleted file mode 100644 index 4ca51162..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// GetAvailableTemplatesReader is a Reader for the GetAvailableTemplates structure. -type GetAvailableTemplatesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetAvailableTemplatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetAvailableTemplatesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewGetAvailableTemplatesDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewGetAvailableTemplatesOK creates a GetAvailableTemplatesOK with default headers values -func NewGetAvailableTemplatesOK() *GetAvailableTemplatesOK { - return &GetAvailableTemplatesOK{} -} - -/* -GetAvailableTemplatesOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type GetAvailableTemplatesOK struct { - Payload *models.HashicorpCloudVault20201125GetAvailableTemplatesResponse -} - -// IsSuccess returns true when this get available templates o k response has a 2xx status code -func (o *GetAvailableTemplatesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get available templates o k response has a 3xx status code -func (o *GetAvailableTemplatesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get available templates o k response has a 4xx status code -func (o *GetAvailableTemplatesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get available templates o k response has a 5xx status code -func (o *GetAvailableTemplatesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get available templates o k response a status code equal to that given -func (o *GetAvailableTemplatesOK) IsCode(code int) bool { - return code == 200 -} - -func (o *GetAvailableTemplatesOK) Error() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] getAvailableTemplatesOK %+v", 200, o.Payload) -} - -func (o *GetAvailableTemplatesOK) String() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] getAvailableTemplatesOK %+v", 200, o.Payload) -} - -func (o *GetAvailableTemplatesOK) GetPayload() *models.HashicorpCloudVault20201125GetAvailableTemplatesResponse { - return o.Payload -} - -func (o *GetAvailableTemplatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125GetAvailableTemplatesResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetAvailableTemplatesDefault creates a GetAvailableTemplatesDefault with default headers values -func NewGetAvailableTemplatesDefault(code int) *GetAvailableTemplatesDefault { - return &GetAvailableTemplatesDefault{ - _statusCode: code, - } -} - -/* -GetAvailableTemplatesDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type GetAvailableTemplatesDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the get available templates default response -func (o *GetAvailableTemplatesDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this get available templates default response has a 2xx status code -func (o *GetAvailableTemplatesDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this get available templates default response has a 3xx status code -func (o *GetAvailableTemplatesDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this get available templates default response has a 4xx status code -func (o *GetAvailableTemplatesDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this get available templates default response has a 5xx status code -func (o *GetAvailableTemplatesDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this get available templates default response a status code equal to that given -func (o *GetAvailableTemplatesDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *GetAvailableTemplatesDefault) Error() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] GetAvailableTemplates default %+v", o._statusCode, o.Payload) -} - -func (o *GetAvailableTemplatesDefault) String() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] GetAvailableTemplates default %+v", o._statusCode, o.Payload) -} - -func (o *GetAvailableTemplatesDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *GetAvailableTemplatesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go new file mode 100644 index 00000000..90497e59 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go @@ -0,0 +1,272 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetLinkedClusterPolicyParams creates a new GetLinkedClusterPolicyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetLinkedClusterPolicyParams() *GetLinkedClusterPolicyParams { + return &GetLinkedClusterPolicyParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetLinkedClusterPolicyParamsWithTimeout creates a new GetLinkedClusterPolicyParams object +// with the ability to set a timeout on a request. +func NewGetLinkedClusterPolicyParamsWithTimeout(timeout time.Duration) *GetLinkedClusterPolicyParams { + return &GetLinkedClusterPolicyParams{ + timeout: timeout, + } +} + +// NewGetLinkedClusterPolicyParamsWithContext creates a new GetLinkedClusterPolicyParams object +// with the ability to set a context for a request. +func NewGetLinkedClusterPolicyParamsWithContext(ctx context.Context) *GetLinkedClusterPolicyParams { + return &GetLinkedClusterPolicyParams{ + Context: ctx, + } +} + +// NewGetLinkedClusterPolicyParamsWithHTTPClient creates a new GetLinkedClusterPolicyParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetLinkedClusterPolicyParamsWithHTTPClient(client *http.Client) *GetLinkedClusterPolicyParams { + return &GetLinkedClusterPolicyParams{ + HTTPClient: client, + } +} + +/* +GetLinkedClusterPolicyParams contains all the parameters to send to the API endpoint + + for the get linked cluster policy operation. + + Typically these are written to a http.Request. +*/ +type GetLinkedClusterPolicyParams struct { + + // ClusterID. + ClusterID *string + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + /* LocationRegionProvider. + + provider is the named cloud provider ("aws", "gcp", "azure"). + */ + LocationRegionProvider *string + + /* LocationRegionRegion. + + region is the cloud region ("us-west1", "us-east1"). + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get linked cluster policy params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLinkedClusterPolicyParams) WithDefaults() *GetLinkedClusterPolicyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get linked cluster policy params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetLinkedClusterPolicyParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithTimeout(timeout time.Duration) *GetLinkedClusterPolicyParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithContext(ctx context.Context) *GetLinkedClusterPolicyParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithHTTPClient(client *http.Client) *GetLinkedClusterPolicyParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClusterID adds the clusterID to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithClusterID(clusterID *string) *GetLinkedClusterPolicyParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetClusterID(clusterID *string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithLocationOrganizationID(locationOrganizationID string) *GetLinkedClusterPolicyParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithLocationProjectID(locationProjectID string) *GetLinkedClusterPolicyParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithLocationRegionProvider(locationRegionProvider *string) *GetLinkedClusterPolicyParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) WithLocationRegionRegion(locationRegionRegion *string) *GetLinkedClusterPolicyParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the get linked cluster policy params +func (o *GetLinkedClusterPolicyParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *GetLinkedClusterPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ClusterID != nil { + + // query param cluster_id + var qrClusterID string + + if o.ClusterID != nil { + qrClusterID = *o.ClusterID + } + qClusterID := qrClusterID + if qClusterID != "" { + + if err := r.SetQueryParam("cluster_id", qClusterID); err != nil { + return err + } + } + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go new file mode 100644 index 00000000..d50327c3 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// GetLinkedClusterPolicyReader is a Reader for the GetLinkedClusterPolicy structure. +type GetLinkedClusterPolicyReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetLinkedClusterPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetLinkedClusterPolicyOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetLinkedClusterPolicyDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetLinkedClusterPolicyOK creates a GetLinkedClusterPolicyOK with default headers values +func NewGetLinkedClusterPolicyOK() *GetLinkedClusterPolicyOK { + return &GetLinkedClusterPolicyOK{} +} + +/* +GetLinkedClusterPolicyOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetLinkedClusterPolicyOK struct { + Payload *models.HashicorpCloudVault20201125GetLinkedClusterPolicyResponse +} + +// IsSuccess returns true when this get linked cluster policy o k response has a 2xx status code +func (o *GetLinkedClusterPolicyOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get linked cluster policy o k response has a 3xx status code +func (o *GetLinkedClusterPolicyOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get linked cluster policy o k response has a 4xx status code +func (o *GetLinkedClusterPolicyOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get linked cluster policy o k response has a 5xx status code +func (o *GetLinkedClusterPolicyOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get linked cluster policy o k response a status code equal to that given +func (o *GetLinkedClusterPolicyOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetLinkedClusterPolicyOK) Error() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) +} + +func (o *GetLinkedClusterPolicyOK) String() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) +} + +func (o *GetLinkedClusterPolicyOK) GetPayload() *models.HashicorpCloudVault20201125GetLinkedClusterPolicyResponse { + return o.Payload +} + +func (o *GetLinkedClusterPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetLinkedClusterPolicyDefault creates a GetLinkedClusterPolicyDefault with default headers values +func NewGetLinkedClusterPolicyDefault(code int) *GetLinkedClusterPolicyDefault { + return &GetLinkedClusterPolicyDefault{ + _statusCode: code, + } +} + +/* +GetLinkedClusterPolicyDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetLinkedClusterPolicyDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the get linked cluster policy default response +func (o *GetLinkedClusterPolicyDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this get linked cluster policy default response has a 2xx status code +func (o *GetLinkedClusterPolicyDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get linked cluster policy default response has a 3xx status code +func (o *GetLinkedClusterPolicyDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get linked cluster policy default response has a 4xx status code +func (o *GetLinkedClusterPolicyDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get linked cluster policy default response has a 5xx status code +func (o *GetLinkedClusterPolicyDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get linked cluster policy default response a status code equal to that given +func (o *GetLinkedClusterPolicyDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *GetLinkedClusterPolicyDefault) Error() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) +} + +func (o *GetLinkedClusterPolicyDefault) String() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) +} + +func (o *GetLinkedClusterPolicyDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *GetLinkedClusterPolicyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go deleted file mode 100644 index 0569b382..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// NewIsVaultPluginRegisteredParams creates a new IsVaultPluginRegisteredParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewIsVaultPluginRegisteredParams() *IsVaultPluginRegisteredParams { - return &IsVaultPluginRegisteredParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewIsVaultPluginRegisteredParamsWithTimeout creates a new IsVaultPluginRegisteredParams object -// with the ability to set a timeout on a request. -func NewIsVaultPluginRegisteredParamsWithTimeout(timeout time.Duration) *IsVaultPluginRegisteredParams { - return &IsVaultPluginRegisteredParams{ - timeout: timeout, - } -} - -// NewIsVaultPluginRegisteredParamsWithContext creates a new IsVaultPluginRegisteredParams object -// with the ability to set a context for a request. -func NewIsVaultPluginRegisteredParamsWithContext(ctx context.Context) *IsVaultPluginRegisteredParams { - return &IsVaultPluginRegisteredParams{ - Context: ctx, - } -} - -// NewIsVaultPluginRegisteredParamsWithHTTPClient creates a new IsVaultPluginRegisteredParams object -// with the ability to set a custom HTTPClient for a request. -func NewIsVaultPluginRegisteredParamsWithHTTPClient(client *http.Client) *IsVaultPluginRegisteredParams { - return &IsVaultPluginRegisteredParams{ - HTTPClient: client, - } -} - -/* -IsVaultPluginRegisteredParams contains all the parameters to send to the API endpoint - - for the is vault plugin registered operation. - - Typically these are written to a http.Request. -*/ -type IsVaultPluginRegisteredParams struct { - - // Body. - Body *models.HashicorpCloudVault20201125IsVaultPluginRegisteredRequest - - // ClusterID. - ClusterID string - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the is vault plugin registered params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *IsVaultPluginRegisteredParams) WithDefaults() *IsVaultPluginRegisteredParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the is vault plugin registered params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *IsVaultPluginRegisteredParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithTimeout(timeout time.Duration) *IsVaultPluginRegisteredParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithContext(ctx context.Context) *IsVaultPluginRegisteredParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithHTTPClient(client *http.Client) *IsVaultPluginRegisteredParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithBody(body *models.HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) *IsVaultPluginRegisteredParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetBody(body *models.HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) { - o.Body = body -} - -// WithClusterID adds the clusterID to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithClusterID(clusterID string) *IsVaultPluginRegisteredParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WithLocationOrganizationID adds the locationOrganizationID to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithLocationOrganizationID(locationOrganizationID string) *IsVaultPluginRegisteredParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) WithLocationProjectID(locationProjectID string) *IsVaultPluginRegisteredParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the is vault plugin registered params -func (o *IsVaultPluginRegisteredParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WriteToRequest writes these params to a swagger request -func (o *IsVaultPluginRegisteredParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go deleted file mode 100644 index 4a07c188..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// IsVaultPluginRegisteredReader is a Reader for the IsVaultPluginRegistered structure. -type IsVaultPluginRegisteredReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *IsVaultPluginRegisteredReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewIsVaultPluginRegisteredOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewIsVaultPluginRegisteredDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewIsVaultPluginRegisteredOK creates a IsVaultPluginRegisteredOK with default headers values -func NewIsVaultPluginRegisteredOK() *IsVaultPluginRegisteredOK { - return &IsVaultPluginRegisteredOK{} -} - -/* -IsVaultPluginRegisteredOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type IsVaultPluginRegisteredOK struct { - Payload *models.HashicorpCloudVault20201125IsVaultPluginRegisteredResponse -} - -// IsSuccess returns true when this is vault plugin registered o k response has a 2xx status code -func (o *IsVaultPluginRegisteredOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this is vault plugin registered o k response has a 3xx status code -func (o *IsVaultPluginRegisteredOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this is vault plugin registered o k response has a 4xx status code -func (o *IsVaultPluginRegisteredOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this is vault plugin registered o k response has a 5xx status code -func (o *IsVaultPluginRegisteredOK) IsServerError() bool { - return false -} - -// IsCode returns true when this is vault plugin registered o k response a status code equal to that given -func (o *IsVaultPluginRegisteredOK) IsCode(code int) bool { - return code == 200 -} - -func (o *IsVaultPluginRegisteredOK) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] isVaultPluginRegisteredOK %+v", 200, o.Payload) -} - -func (o *IsVaultPluginRegisteredOK) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] isVaultPluginRegisteredOK %+v", 200, o.Payload) -} - -func (o *IsVaultPluginRegisteredOK) GetPayload() *models.HashicorpCloudVault20201125IsVaultPluginRegisteredResponse { - return o.Payload -} - -func (o *IsVaultPluginRegisteredOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewIsVaultPluginRegisteredDefault creates a IsVaultPluginRegisteredDefault with default headers values -func NewIsVaultPluginRegisteredDefault(code int) *IsVaultPluginRegisteredDefault { - return &IsVaultPluginRegisteredDefault{ - _statusCode: code, - } -} - -/* -IsVaultPluginRegisteredDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type IsVaultPluginRegisteredDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the is vault plugin registered default response -func (o *IsVaultPluginRegisteredDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this is vault plugin registered default response has a 2xx status code -func (o *IsVaultPluginRegisteredDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this is vault plugin registered default response has a 3xx status code -func (o *IsVaultPluginRegisteredDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this is vault plugin registered default response has a 4xx status code -func (o *IsVaultPluginRegisteredDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this is vault plugin registered default response has a 5xx status code -func (o *IsVaultPluginRegisteredDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this is vault plugin registered default response a status code equal to that given -func (o *IsVaultPluginRegisteredDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *IsVaultPluginRegisteredDefault) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] IsVaultPluginRegistered default %+v", o._statusCode, o.Payload) -} - -func (o *IsVaultPluginRegisteredDefault) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] IsVaultPluginRegistered default %+v", o._statusCode, o.Payload) -} - -func (o *IsVaultPluginRegisteredDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *IsVaultPluginRegisteredDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go deleted file mode 100644 index b884c5c1..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go +++ /dev/null @@ -1,384 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListAllClustersParams creates a new ListAllClustersParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewListAllClustersParams() *ListAllClustersParams { - return &ListAllClustersParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewListAllClustersParamsWithTimeout creates a new ListAllClustersParams object -// with the ability to set a timeout on a request. -func NewListAllClustersParamsWithTimeout(timeout time.Duration) *ListAllClustersParams { - return &ListAllClustersParams{ - timeout: timeout, - } -} - -// NewListAllClustersParamsWithContext creates a new ListAllClustersParams object -// with the ability to set a context for a request. -func NewListAllClustersParamsWithContext(ctx context.Context) *ListAllClustersParams { - return &ListAllClustersParams{ - Context: ctx, - } -} - -// NewListAllClustersParamsWithHTTPClient creates a new ListAllClustersParams object -// with the ability to set a custom HTTPClient for a request. -func NewListAllClustersParamsWithHTTPClient(client *http.Client) *ListAllClustersParams { - return &ListAllClustersParams{ - HTTPClient: client, - } -} - -/* -ListAllClustersParams contains all the parameters to send to the API endpoint - - for the list all clusters operation. - - Typically these are written to a http.Request. -*/ -type ListAllClustersParams struct { - - // FiltersPrimariesOnly. - FiltersPrimariesOnly *bool - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - /* LocationRegionProvider. - - provider is the named cloud provider ("aws", "gcp", "azure"). - */ - LocationRegionProvider *string - - /* LocationRegionRegion. - - region is the cloud region ("us-west1", "us-east1"). - */ - LocationRegionRegion *string - - /* PaginationNextPageToken. - - Specifies a page token to use to retrieve the next page. Set this to the - `next_page_token` returned by previous list requests to get the next page of - results. If set, `previous_page_token` must not be set. - */ - PaginationNextPageToken *string - - /* PaginationPageSize. - - The max number of results per page that should be returned. If the number - of available results is larger than `page_size`, a `next_page_token` is - returned which can be used to get the next page of results in subsequent - requests. A value of zero will cause `page_size` to be defaulted. - - Format: int64 - */ - PaginationPageSize *int64 - - /* PaginationPreviousPageToken. - - Specifies a page token to use to retrieve the previous page. Set this to - the `previous_page_token` returned by previous list requests to get the - previous page of results. If set, `next_page_token` must not be set. - */ - PaginationPreviousPageToken *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the list all clusters params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListAllClustersParams) WithDefaults() *ListAllClustersParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the list all clusters params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListAllClustersParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the list all clusters params -func (o *ListAllClustersParams) WithTimeout(timeout time.Duration) *ListAllClustersParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the list all clusters params -func (o *ListAllClustersParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the list all clusters params -func (o *ListAllClustersParams) WithContext(ctx context.Context) *ListAllClustersParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the list all clusters params -func (o *ListAllClustersParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the list all clusters params -func (o *ListAllClustersParams) WithHTTPClient(client *http.Client) *ListAllClustersParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the list all clusters params -func (o *ListAllClustersParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithFiltersPrimariesOnly adds the filtersPrimariesOnly to the list all clusters params -func (o *ListAllClustersParams) WithFiltersPrimariesOnly(filtersPrimariesOnly *bool) *ListAllClustersParams { - o.SetFiltersPrimariesOnly(filtersPrimariesOnly) - return o -} - -// SetFiltersPrimariesOnly adds the filtersPrimariesOnly to the list all clusters params -func (o *ListAllClustersParams) SetFiltersPrimariesOnly(filtersPrimariesOnly *bool) { - o.FiltersPrimariesOnly = filtersPrimariesOnly -} - -// WithLocationOrganizationID adds the locationOrganizationID to the list all clusters params -func (o *ListAllClustersParams) WithLocationOrganizationID(locationOrganizationID string) *ListAllClustersParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the list all clusters params -func (o *ListAllClustersParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the list all clusters params -func (o *ListAllClustersParams) WithLocationProjectID(locationProjectID string) *ListAllClustersParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the list all clusters params -func (o *ListAllClustersParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WithLocationRegionProvider adds the locationRegionProvider to the list all clusters params -func (o *ListAllClustersParams) WithLocationRegionProvider(locationRegionProvider *string) *ListAllClustersParams { - o.SetLocationRegionProvider(locationRegionProvider) - return o -} - -// SetLocationRegionProvider adds the locationRegionProvider to the list all clusters params -func (o *ListAllClustersParams) SetLocationRegionProvider(locationRegionProvider *string) { - o.LocationRegionProvider = locationRegionProvider -} - -// WithLocationRegionRegion adds the locationRegionRegion to the list all clusters params -func (o *ListAllClustersParams) WithLocationRegionRegion(locationRegionRegion *string) *ListAllClustersParams { - o.SetLocationRegionRegion(locationRegionRegion) - return o -} - -// SetLocationRegionRegion adds the locationRegionRegion to the list all clusters params -func (o *ListAllClustersParams) SetLocationRegionRegion(locationRegionRegion *string) { - o.LocationRegionRegion = locationRegionRegion -} - -// WithPaginationNextPageToken adds the paginationNextPageToken to the list all clusters params -func (o *ListAllClustersParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListAllClustersParams { - o.SetPaginationNextPageToken(paginationNextPageToken) - return o -} - -// SetPaginationNextPageToken adds the paginationNextPageToken to the list all clusters params -func (o *ListAllClustersParams) SetPaginationNextPageToken(paginationNextPageToken *string) { - o.PaginationNextPageToken = paginationNextPageToken -} - -// WithPaginationPageSize adds the paginationPageSize to the list all clusters params -func (o *ListAllClustersParams) WithPaginationPageSize(paginationPageSize *int64) *ListAllClustersParams { - o.SetPaginationPageSize(paginationPageSize) - return o -} - -// SetPaginationPageSize adds the paginationPageSize to the list all clusters params -func (o *ListAllClustersParams) SetPaginationPageSize(paginationPageSize *int64) { - o.PaginationPageSize = paginationPageSize -} - -// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list all clusters params -func (o *ListAllClustersParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListAllClustersParams { - o.SetPaginationPreviousPageToken(paginationPreviousPageToken) - return o -} - -// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list all clusters params -func (o *ListAllClustersParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { - o.PaginationPreviousPageToken = paginationPreviousPageToken -} - -// WriteToRequest writes these params to a swagger request -func (o *ListAllClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.FiltersPrimariesOnly != nil { - - // query param filters.primaries_only - var qrFiltersPrimariesOnly bool - - if o.FiltersPrimariesOnly != nil { - qrFiltersPrimariesOnly = *o.FiltersPrimariesOnly - } - qFiltersPrimariesOnly := swag.FormatBool(qrFiltersPrimariesOnly) - if qFiltersPrimariesOnly != "" { - - if err := r.SetQueryParam("filters.primaries_only", qFiltersPrimariesOnly); err != nil { - return err - } - } - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if o.LocationRegionProvider != nil { - - // query param location.region.provider - var qrLocationRegionProvider string - - if o.LocationRegionProvider != nil { - qrLocationRegionProvider = *o.LocationRegionProvider - } - qLocationRegionProvider := qrLocationRegionProvider - if qLocationRegionProvider != "" { - - if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { - return err - } - } - } - - if o.LocationRegionRegion != nil { - - // query param location.region.region - var qrLocationRegionRegion string - - if o.LocationRegionRegion != nil { - qrLocationRegionRegion = *o.LocationRegionRegion - } - qLocationRegionRegion := qrLocationRegionRegion - if qLocationRegionRegion != "" { - - if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { - return err - } - } - } - - if o.PaginationNextPageToken != nil { - - // query param pagination.next_page_token - var qrPaginationNextPageToken string - - if o.PaginationNextPageToken != nil { - qrPaginationNextPageToken = *o.PaginationNextPageToken - } - qPaginationNextPageToken := qrPaginationNextPageToken - if qPaginationNextPageToken != "" { - - if err := r.SetQueryParam("pagination.next_page_token", qPaginationNextPageToken); err != nil { - return err - } - } - } - - if o.PaginationPageSize != nil { - - // query param pagination.page_size - var qrPaginationPageSize int64 - - if o.PaginationPageSize != nil { - qrPaginationPageSize = *o.PaginationPageSize - } - qPaginationPageSize := swag.FormatInt64(qrPaginationPageSize) - if qPaginationPageSize != "" { - - if err := r.SetQueryParam("pagination.page_size", qPaginationPageSize); err != nil { - return err - } - } - } - - if o.PaginationPreviousPageToken != nil { - - // query param pagination.previous_page_token - var qrPaginationPreviousPageToken string - - if o.PaginationPreviousPageToken != nil { - qrPaginationPreviousPageToken = *o.PaginationPreviousPageToken - } - qPaginationPreviousPageToken := qrPaginationPreviousPageToken - if qPaginationPreviousPageToken != "" { - - if err := r.SetQueryParam("pagination.previous_page_token", qPaginationPreviousPageToken); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go deleted file mode 100644 index 7aaa1130..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// ListAllClustersReader is a Reader for the ListAllClusters structure. -type ListAllClustersReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ListAllClustersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewListAllClustersOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewListAllClustersDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewListAllClustersOK creates a ListAllClustersOK with default headers values -func NewListAllClustersOK() *ListAllClustersOK { - return &ListAllClustersOK{} -} - -/* -ListAllClustersOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ListAllClustersOK struct { - Payload *models.HashicorpCloudVault20201125ListAllClustersResponse -} - -// IsSuccess returns true when this list all clusters o k response has a 2xx status code -func (o *ListAllClustersOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this list all clusters o k response has a 3xx status code -func (o *ListAllClustersOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this list all clusters o k response has a 4xx status code -func (o *ListAllClustersOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this list all clusters o k response has a 5xx status code -func (o *ListAllClustersOK) IsServerError() bool { - return false -} - -// IsCode returns true when this list all clusters o k response a status code equal to that given -func (o *ListAllClustersOK) IsCode(code int) bool { - return code == 200 -} - -func (o *ListAllClustersOK) Error() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] listAllClustersOK %+v", 200, o.Payload) -} - -func (o *ListAllClustersOK) String() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] listAllClustersOK %+v", 200, o.Payload) -} - -func (o *ListAllClustersOK) GetPayload() *models.HashicorpCloudVault20201125ListAllClustersResponse { - return o.Payload -} - -func (o *ListAllClustersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125ListAllClustersResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewListAllClustersDefault creates a ListAllClustersDefault with default headers values -func NewListAllClustersDefault(code int) *ListAllClustersDefault { - return &ListAllClustersDefault{ - _statusCode: code, - } -} - -/* -ListAllClustersDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ListAllClustersDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the list all clusters default response -func (o *ListAllClustersDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this list all clusters default response has a 2xx status code -func (o *ListAllClustersDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this list all clusters default response has a 3xx status code -func (o *ListAllClustersDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this list all clusters default response has a 4xx status code -func (o *ListAllClustersDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this list all clusters default response has a 5xx status code -func (o *ListAllClustersDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this list all clusters default response a status code equal to that given -func (o *ListAllClustersDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *ListAllClustersDefault) Error() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] ListAllClusters default %+v", o._statusCode, o.Payload) -} - -func (o *ListAllClustersDefault) String() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] ListAllClusters default %+v", o._statusCode, o.Payload) -} - -func (o *ListAllClustersDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *ListAllClustersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go index 4faf3472..770bc4e1 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go @@ -98,21 +98,10 @@ type ListSnapshotsParams struct { /* ResourceID. - id is the ID of the resource. This may be a slug ID or a UUID depending on - the resource, and as such has no guarantee that it is globally unique. If a - globally unique identifier for the resource is required, refer to - internal_id. + id is the identifier for this resource. */ ResourceID *string - /* ResourceInternalID. - - internal_id is a globally unique identifier for the resource. In the case - that a resource has a user specifiable identifier, the internal_id will - differ. - */ - ResourceInternalID *string - /* ResourceLocationOrganizationID. organization_id is the id of the organization. @@ -148,7 +137,7 @@ type ListSnapshotsParams struct { /* ResourceUUID. - uuid is being deprecated in favor of the id field. + uuid is the unique UUID for this resource. */ ResourceUUID *string @@ -260,17 +249,6 @@ func (o *ListSnapshotsParams) SetResourceID(resourceID *string) { o.ResourceID = resourceID } -// WithResourceInternalID adds the resourceInternalID to the list snapshots params -func (o *ListSnapshotsParams) WithResourceInternalID(resourceInternalID *string) *ListSnapshotsParams { - o.SetResourceInternalID(resourceInternalID) - return o -} - -// SetResourceInternalID adds the resourceInternalId to the list snapshots params -func (o *ListSnapshotsParams) SetResourceInternalID(resourceInternalID *string) { - o.ResourceInternalID = resourceInternalID -} - // WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the list snapshots params func (o *ListSnapshotsParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *ListSnapshotsParams { o.SetResourceLocationOrganizationID(resourceLocationOrganizationID) @@ -430,23 +408,6 @@ func (o *ListSnapshotsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt } } - if o.ResourceInternalID != nil { - - // query param resource.internal_id - var qrResourceInternalID string - - if o.ResourceInternalID != nil { - qrResourceInternalID = *o.ResourceInternalID - } - qResourceInternalID := qrResourceInternalID - if qResourceInternalID != "" { - - if err := r.SetQueryParam("resource.internal_id", qResourceInternalID); err != nil { - return err - } - } - } - // path param resource.location.organization_id if err := r.SetPathParam("resource.location.organization_id", o.ResourceLocationOrganizationID); err != nil { return err diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go deleted file mode 100644 index c1c5fa29..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// NewLockParams creates a new LockParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewLockParams() *LockParams { - return &LockParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewLockParamsWithTimeout creates a new LockParams object -// with the ability to set a timeout on a request. -func NewLockParamsWithTimeout(timeout time.Duration) *LockParams { - return &LockParams{ - timeout: timeout, - } -} - -// NewLockParamsWithContext creates a new LockParams object -// with the ability to set a context for a request. -func NewLockParamsWithContext(ctx context.Context) *LockParams { - return &LockParams{ - Context: ctx, - } -} - -// NewLockParamsWithHTTPClient creates a new LockParams object -// with the ability to set a custom HTTPClient for a request. -func NewLockParamsWithHTTPClient(client *http.Client) *LockParams { - return &LockParams{ - HTTPClient: client, - } -} - -/* -LockParams contains all the parameters to send to the API endpoint - - for the lock operation. - - Typically these are written to a http.Request. -*/ -type LockParams struct { - - // Body. - Body *models.HashicorpCloudVault20201125LockRequest - - // ClusterID. - ClusterID string - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the lock params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *LockParams) WithDefaults() *LockParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the lock params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *LockParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the lock params -func (o *LockParams) WithTimeout(timeout time.Duration) *LockParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the lock params -func (o *LockParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the lock params -func (o *LockParams) WithContext(ctx context.Context) *LockParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the lock params -func (o *LockParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the lock params -func (o *LockParams) WithHTTPClient(client *http.Client) *LockParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the lock params -func (o *LockParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the lock params -func (o *LockParams) WithBody(body *models.HashicorpCloudVault20201125LockRequest) *LockParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the lock params -func (o *LockParams) SetBody(body *models.HashicorpCloudVault20201125LockRequest) { - o.Body = body -} - -// WithClusterID adds the clusterID to the lock params -func (o *LockParams) WithClusterID(clusterID string) *LockParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the lock params -func (o *LockParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WithLocationOrganizationID adds the locationOrganizationID to the lock params -func (o *LockParams) WithLocationOrganizationID(locationOrganizationID string) *LockParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the lock params -func (o *LockParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the lock params -func (o *LockParams) WithLocationProjectID(locationProjectID string) *LockParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the lock params -func (o *LockParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WriteToRequest writes these params to a swagger request -func (o *LockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go deleted file mode 100644 index 63359d24..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// LockReader is a Reader for the Lock structure. -type LockReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *LockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewLockOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewLockDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewLockOK creates a LockOK with default headers values -func NewLockOK() *LockOK { - return &LockOK{} -} - -/* -LockOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type LockOK struct { - Payload *models.HashicorpCloudVault20201125LockResponse -} - -// IsSuccess returns true when this lock o k response has a 2xx status code -func (o *LockOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this lock o k response has a 3xx status code -func (o *LockOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this lock o k response has a 4xx status code -func (o *LockOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this lock o k response has a 5xx status code -func (o *LockOK) IsServerError() bool { - return false -} - -// IsCode returns true when this lock o k response a status code equal to that given -func (o *LockOK) IsCode(code int) bool { - return code == 200 -} - -func (o *LockOK) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] lockOK %+v", 200, o.Payload) -} - -func (o *LockOK) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] lockOK %+v", 200, o.Payload) -} - -func (o *LockOK) GetPayload() *models.HashicorpCloudVault20201125LockResponse { - return o.Payload -} - -func (o *LockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125LockResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewLockDefault creates a LockDefault with default headers values -func NewLockDefault(code int) *LockDefault { - return &LockDefault{ - _statusCode: code, - } -} - -/* -LockDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type LockDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the lock default response -func (o *LockDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this lock default response has a 2xx status code -func (o *LockDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this lock default response has a 3xx status code -func (o *LockDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this lock default response has a 4xx status code -func (o *LockDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this lock default response has a 5xx status code -func (o *LockDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this lock default response a status code equal to that given -func (o *LockDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *LockDefault) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] Lock default %+v", o._statusCode, o.Payload) -} - -func (o *LockDefault) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] Lock default %+v", o._statusCode, o.Payload) -} - -func (o *LockDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *LockDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go deleted file mode 100644 index 661f4a5f..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// NewRevokeAdminTokensParams creates a new RevokeAdminTokensParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewRevokeAdminTokensParams() *RevokeAdminTokensParams { - return &RevokeAdminTokensParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewRevokeAdminTokensParamsWithTimeout creates a new RevokeAdminTokensParams object -// with the ability to set a timeout on a request. -func NewRevokeAdminTokensParamsWithTimeout(timeout time.Duration) *RevokeAdminTokensParams { - return &RevokeAdminTokensParams{ - timeout: timeout, - } -} - -// NewRevokeAdminTokensParamsWithContext creates a new RevokeAdminTokensParams object -// with the ability to set a context for a request. -func NewRevokeAdminTokensParamsWithContext(ctx context.Context) *RevokeAdminTokensParams { - return &RevokeAdminTokensParams{ - Context: ctx, - } -} - -// NewRevokeAdminTokensParamsWithHTTPClient creates a new RevokeAdminTokensParams object -// with the ability to set a custom HTTPClient for a request. -func NewRevokeAdminTokensParamsWithHTTPClient(client *http.Client) *RevokeAdminTokensParams { - return &RevokeAdminTokensParams{ - HTTPClient: client, - } -} - -/* -RevokeAdminTokensParams contains all the parameters to send to the API endpoint - - for the revoke admin tokens operation. - - Typically these are written to a http.Request. -*/ -type RevokeAdminTokensParams struct { - - // Body. - Body *models.HashicorpCloudVault20201125RevokeAdminTokensRequest - - // ClusterID. - ClusterID string - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the revoke admin tokens params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *RevokeAdminTokensParams) WithDefaults() *RevokeAdminTokensParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the revoke admin tokens params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *RevokeAdminTokensParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithTimeout(timeout time.Duration) *RevokeAdminTokensParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithContext(ctx context.Context) *RevokeAdminTokensParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithHTTPClient(client *http.Client) *RevokeAdminTokensParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithBody(body *models.HashicorpCloudVault20201125RevokeAdminTokensRequest) *RevokeAdminTokensParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetBody(body *models.HashicorpCloudVault20201125RevokeAdminTokensRequest) { - o.Body = body -} - -// WithClusterID adds the clusterID to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithClusterID(clusterID string) *RevokeAdminTokensParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WithLocationOrganizationID adds the locationOrganizationID to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithLocationOrganizationID(locationOrganizationID string) *RevokeAdminTokensParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the revoke admin tokens params -func (o *RevokeAdminTokensParams) WithLocationProjectID(locationProjectID string) *RevokeAdminTokensParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the revoke admin tokens params -func (o *RevokeAdminTokensParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WriteToRequest writes these params to a swagger request -func (o *RevokeAdminTokensParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go deleted file mode 100644 index 7648b6dd..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go +++ /dev/null @@ -1,176 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// RevokeAdminTokensReader is a Reader for the RevokeAdminTokens structure. -type RevokeAdminTokensReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *RevokeAdminTokensReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewRevokeAdminTokensOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewRevokeAdminTokensDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewRevokeAdminTokensOK creates a RevokeAdminTokensOK with default headers values -func NewRevokeAdminTokensOK() *RevokeAdminTokensOK { - return &RevokeAdminTokensOK{} -} - -/* -RevokeAdminTokensOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type RevokeAdminTokensOK struct { - Payload models.HashicorpCloudVault20201125RevokeAdminTokensResponse -} - -// IsSuccess returns true when this revoke admin tokens o k response has a 2xx status code -func (o *RevokeAdminTokensOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this revoke admin tokens o k response has a 3xx status code -func (o *RevokeAdminTokensOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this revoke admin tokens o k response has a 4xx status code -func (o *RevokeAdminTokensOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this revoke admin tokens o k response has a 5xx status code -func (o *RevokeAdminTokensOK) IsServerError() bool { - return false -} - -// IsCode returns true when this revoke admin tokens o k response a status code equal to that given -func (o *RevokeAdminTokensOK) IsCode(code int) bool { - return code == 200 -} - -func (o *RevokeAdminTokensOK) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] revokeAdminTokensOK %+v", 200, o.Payload) -} - -func (o *RevokeAdminTokensOK) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] revokeAdminTokensOK %+v", 200, o.Payload) -} - -func (o *RevokeAdminTokensOK) GetPayload() models.HashicorpCloudVault20201125RevokeAdminTokensResponse { - return o.Payload -} - -func (o *RevokeAdminTokensOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewRevokeAdminTokensDefault creates a RevokeAdminTokensDefault with default headers values -func NewRevokeAdminTokensDefault(code int) *RevokeAdminTokensDefault { - return &RevokeAdminTokensDefault{ - _statusCode: code, - } -} - -/* -RevokeAdminTokensDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type RevokeAdminTokensDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the revoke admin tokens default response -func (o *RevokeAdminTokensDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this revoke admin tokens default response has a 2xx status code -func (o *RevokeAdminTokensDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this revoke admin tokens default response has a 3xx status code -func (o *RevokeAdminTokensDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this revoke admin tokens default response has a 4xx status code -func (o *RevokeAdminTokensDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this revoke admin tokens default response has a 5xx status code -func (o *RevokeAdminTokensDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this revoke admin tokens default response a status code equal to that given -func (o *RevokeAdminTokensDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *RevokeAdminTokensDefault) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] RevokeAdminTokens default %+v", o._statusCode, o.Payload) -} - -func (o *RevokeAdminTokensDefault) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] RevokeAdminTokens default %+v", o._statusCode, o.Payload) -} - -func (o *RevokeAdminTokensDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *RevokeAdminTokensDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go deleted file mode 100644 index a24f29ed..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go +++ /dev/null @@ -1,213 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// NewUnlockParams creates a new UnlockParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewUnlockParams() *UnlockParams { - return &UnlockParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewUnlockParamsWithTimeout creates a new UnlockParams object -// with the ability to set a timeout on a request. -func NewUnlockParamsWithTimeout(timeout time.Duration) *UnlockParams { - return &UnlockParams{ - timeout: timeout, - } -} - -// NewUnlockParamsWithContext creates a new UnlockParams object -// with the ability to set a context for a request. -func NewUnlockParamsWithContext(ctx context.Context) *UnlockParams { - return &UnlockParams{ - Context: ctx, - } -} - -// NewUnlockParamsWithHTTPClient creates a new UnlockParams object -// with the ability to set a custom HTTPClient for a request. -func NewUnlockParamsWithHTTPClient(client *http.Client) *UnlockParams { - return &UnlockParams{ - HTTPClient: client, - } -} - -/* -UnlockParams contains all the parameters to send to the API endpoint - - for the unlock operation. - - Typically these are written to a http.Request. -*/ -type UnlockParams struct { - - // Body. - Body *models.HashicorpCloudVault20201125UnlockRequest - - // ClusterID. - ClusterID string - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the unlock params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *UnlockParams) WithDefaults() *UnlockParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the unlock params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *UnlockParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the unlock params -func (o *UnlockParams) WithTimeout(timeout time.Duration) *UnlockParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the unlock params -func (o *UnlockParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the unlock params -func (o *UnlockParams) WithContext(ctx context.Context) *UnlockParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the unlock params -func (o *UnlockParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the unlock params -func (o *UnlockParams) WithHTTPClient(client *http.Client) *UnlockParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the unlock params -func (o *UnlockParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the unlock params -func (o *UnlockParams) WithBody(body *models.HashicorpCloudVault20201125UnlockRequest) *UnlockParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the unlock params -func (o *UnlockParams) SetBody(body *models.HashicorpCloudVault20201125UnlockRequest) { - o.Body = body -} - -// WithClusterID adds the clusterID to the unlock params -func (o *UnlockParams) WithClusterID(clusterID string) *UnlockParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the unlock params -func (o *UnlockParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WithLocationOrganizationID adds the locationOrganizationID to the unlock params -func (o *UnlockParams) WithLocationOrganizationID(locationOrganizationID string) *UnlockParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the unlock params -func (o *UnlockParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the unlock params -func (o *UnlockParams) WithLocationProjectID(locationProjectID string) *UnlockParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the unlock params -func (o *UnlockParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WriteToRequest writes these params to a swagger request -func (o *UnlockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if o.Body != nil { - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go deleted file mode 100644 index 5968d508..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// UnlockReader is a Reader for the Unlock structure. -type UnlockReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *UnlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewUnlockOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewUnlockDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewUnlockOK creates a UnlockOK with default headers values -func NewUnlockOK() *UnlockOK { - return &UnlockOK{} -} - -/* -UnlockOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type UnlockOK struct { - Payload *models.HashicorpCloudVault20201125UnlockResponse -} - -// IsSuccess returns true when this unlock o k response has a 2xx status code -func (o *UnlockOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this unlock o k response has a 3xx status code -func (o *UnlockOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this unlock o k response has a 4xx status code -func (o *UnlockOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this unlock o k response has a 5xx status code -func (o *UnlockOK) IsServerError() bool { - return false -} - -// IsCode returns true when this unlock o k response a status code equal to that given -func (o *UnlockOK) IsCode(code int) bool { - return code == 200 -} - -func (o *UnlockOK) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] unlockOK %+v", 200, o.Payload) -} - -func (o *UnlockOK) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] unlockOK %+v", 200, o.Payload) -} - -func (o *UnlockOK) GetPayload() *models.HashicorpCloudVault20201125UnlockResponse { - return o.Payload -} - -func (o *UnlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125UnlockResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewUnlockDefault creates a UnlockDefault with default headers values -func NewUnlockDefault(code int) *UnlockDefault { - return &UnlockDefault{ - _statusCode: code, - } -} - -/* -UnlockDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type UnlockDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the unlock default response -func (o *UnlockDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this unlock default response has a 2xx status code -func (o *UnlockDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this unlock default response has a 3xx status code -func (o *UnlockDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this unlock default response has a 4xx status code -func (o *UnlockDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this unlock default response has a 5xx status code -func (o *UnlockDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this unlock default response a status code equal to that given -func (o *UnlockDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *UnlockDefault) Error() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] Unlock default %+v", o._statusCode, o.Payload) -} - -func (o *UnlockDefault) String() string { - return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] Unlock default %+v", o._statusCode, o.Payload) -} - -func (o *UnlockDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *UnlockDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go index 3c043c4f..67c35d1d 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go @@ -36,8 +36,6 @@ type ClientService interface { DeletePathsFilter(params *DeletePathsFilterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePathsFilterOK, error) - DeleteSentinelPolicy(params *DeleteSentinelPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSentinelPolicyOK, error) - DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSnapshotOK, error) DeregisterLinkedCluster(params *DeregisterLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeregisterLinkedClusterOK, error) @@ -54,8 +52,6 @@ type ClientService interface { GetAvailableProviders(params *GetAvailableProvidersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAvailableProvidersOK, error) - GetAvailableTemplates(params *GetAvailableTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAvailableTemplatesOK, error) - GetCORSConfig(params *GetCORSConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCORSConfigOK, error) GetClientCounts(params *GetClientCountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClientCountsOK, error) @@ -64,36 +60,28 @@ type ClientService interface { GetLinkedCluster(params *GetLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterOK, error) + GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterPolicyOK, error) + GetReplicationStatus(params *GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetReplicationStatusOK, error) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSnapshotOK, error) GetUtilization(params *GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUtilizationOK, error) - IsVaultPluginRegistered(params *IsVaultPluginRegisteredParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IsVaultPluginRegisteredOK, error) - List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) - ListAllClusters(params *ListAllClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAllClustersOK, error) - ListPerformanceReplicationSecondaries(params *ListPerformanceReplicationSecondariesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPerformanceReplicationSecondariesOK, error) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListSnapshotsOK, error) - Lock(params *LockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LockOK, error) - RecreateFromSnapshot(params *RecreateFromSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RecreateFromSnapshotOK, error) RegisterLinkedCluster(params *RegisterLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RegisterLinkedClusterOK, error) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RestoreSnapshotOK, error) - RevokeAdminTokens(params *RevokeAdminTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeAdminTokensOK, error) - Seal(params *SealParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SealOK, error) - Unlock(params *UnlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlockOK, error) - Unseal(params *UnsealParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnsealOK, error) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOK, error) @@ -267,44 +255,6 @@ func (a *Client) DeletePathsFilter(params *DeletePathsFilterParams, authInfo run return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -DeleteSentinelPolicy delete sentinel policy API -*/ -func (a *Client) DeleteSentinelPolicy(params *DeleteSentinelPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSentinelPolicyOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteSentinelPolicyParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteSentinelPolicy", - Method: "POST", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &DeleteSentinelPolicyReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteSentinelPolicyOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*DeleteSentinelPolicyDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* DeleteSnapshot delete snapshot API */ @@ -354,7 +304,7 @@ func (a *Client) DeregisterLinkedCluster(params *DeregisterLinkedClusterParams, op := &runtime.ClientOperation{ ID: "DeregisterLinkedCluster", Method: "DELETE", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}", + PathPattern: "/vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, @@ -609,44 +559,6 @@ func (a *Client) GetAvailableProviders(params *GetAvailableProvidersParams, auth return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -GetAvailableTemplates get available templates API -*/ -func (a *Client) GetAvailableTemplates(params *GetAvailableTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAvailableTemplatesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetAvailableTemplatesParams() - } - op := &runtime.ClientOperation{ - ID: "GetAvailableTemplates", - Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &GetAvailableTemplatesReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetAvailableTemplatesOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*GetAvailableTemplatesDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* GetCORSConfig get c o r s config API */ @@ -800,22 +712,22 @@ func (a *Client) GetLinkedCluster(params *GetLinkedClusterParams, authInfo runti } /* -GetReplicationStatus get replication status API +GetLinkedClusterPolicy get linked cluster policy API */ -func (a *Client) GetReplicationStatus(params *GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetReplicationStatusOK, error) { +func (a *Client) GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterPolicyOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetReplicationStatusParams() + params = NewGetLinkedClusterPolicyParams() } op := &runtime.ClientOperation{ - ID: "GetReplicationStatus", + ID: "GetLinkedClusterPolicy", Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/replication-status", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetReplicationStatusReader{formats: a.formats}, + Reader: &GetLinkedClusterPolicyReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -828,32 +740,32 @@ func (a *Client) GetReplicationStatus(params *GetReplicationStatusParams, authIn if err != nil { return nil, err } - success, ok := result.(*GetReplicationStatusOK) + success, ok := result.(*GetLinkedClusterPolicyOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetReplicationStatusDefault) + unexpectedSuccess := result.(*GetLinkedClusterPolicyDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -GetSnapshot get snapshot API +GetReplicationStatus get replication status API */ -func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSnapshotOK, error) { +func (a *Client) GetReplicationStatus(params *GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetReplicationStatusOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetSnapshotParams() + params = NewGetReplicationStatusParams() } op := &runtime.ClientOperation{ - ID: "GetSnapshot", + ID: "GetReplicationStatus", Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/replication-status", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetSnapshotReader{formats: a.formats}, + Reader: &GetReplicationStatusReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -866,32 +778,32 @@ func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientA if err != nil { return nil, err } - success, ok := result.(*GetSnapshotOK) + success, ok := result.(*GetReplicationStatusOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetSnapshotDefault) + unexpectedSuccess := result.(*GetReplicationStatusDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -GetUtilization get utilization API +GetSnapshot get snapshot API */ -func (a *Client) GetUtilization(params *GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUtilizationOK, error) { +func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetUtilizationParams() + params = NewGetSnapshotParams() } op := &runtime.ClientOperation{ - ID: "GetUtilization", + ID: "GetSnapshot", Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/utilization", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetUtilizationReader{formats: a.formats}, + Reader: &GetSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -904,32 +816,32 @@ func (a *Client) GetUtilization(params *GetUtilizationParams, authInfo runtime.C if err != nil { return nil, err } - success, ok := result.(*GetUtilizationOK) + success, ok := result.(*GetSnapshotOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetUtilizationDefault) + unexpectedSuccess := result.(*GetSnapshotDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -IsVaultPluginRegistered is vault plugin registered API +GetUtilization get utilization API */ -func (a *Client) IsVaultPluginRegistered(params *IsVaultPluginRegisteredParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IsVaultPluginRegisteredOK, error) { +func (a *Client) GetUtilization(params *GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUtilizationOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewIsVaultPluginRegisteredParams() + params = NewGetUtilizationParams() } op := &runtime.ClientOperation{ - ID: "IsVaultPluginRegistered", - Method: "POST", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered", + ID: "GetUtilization", + Method: "GET", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/utilization", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &IsVaultPluginRegisteredReader{formats: a.formats}, + Reader: &GetUtilizationReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -942,12 +854,12 @@ func (a *Client) IsVaultPluginRegistered(params *IsVaultPluginRegisteredParams, if err != nil { return nil, err } - success, ok := result.(*IsVaultPluginRegisteredOK) + success, ok := result.(*GetUtilizationOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*IsVaultPluginRegisteredDefault) + unexpectedSuccess := result.(*GetUtilizationDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } @@ -989,44 +901,6 @@ func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -ListAllClusters list all clusters API -*/ -func (a *Client) ListAllClusters(params *ListAllClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAllClustersOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewListAllClustersParams() - } - op := &runtime.ClientOperation{ - ID: "ListAllClusters", - Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &ListAllClustersReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ListAllClustersOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ListAllClustersDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* ListPerformanceReplicationSecondaries list performance replication secondaries API */ @@ -1103,44 +977,6 @@ func (a *Client) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.Cli return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -Lock lock API -*/ -func (a *Client) Lock(params *LockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LockOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewLockParams() - } - op := &runtime.ClientOperation{ - ID: "Lock", - Method: "POST", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &LockReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*LockOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*LockDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* RecreateFromSnapshot recreate from snapshot API */ @@ -1255,44 +1091,6 @@ func (a *Client) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -RevokeAdminTokens revoke admin tokens API -*/ -func (a *Client) RevokeAdminTokens(params *RevokeAdminTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeAdminTokensOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewRevokeAdminTokensParams() - } - op := &runtime.ClientOperation{ - ID: "RevokeAdminTokens", - Method: "POST", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &RevokeAdminTokensReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*RevokeAdminTokensOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*RevokeAdminTokensDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* Seal seal API */ @@ -1331,44 +1129,6 @@ func (a *Client) Seal(params *SealParams, authInfo runtime.ClientAuthInfoWriter, return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } -/* -Unlock unlock API -*/ -func (a *Client) Unlock(params *UnlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlockOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewUnlockParams() - } - op := &runtime.ClientOperation{ - ID: "Unlock", - Method: "POST", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"http"}, - Params: params, - Reader: &UnlockReader{formats: a.formats}, - AuthInfo: authInfo, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*UnlockOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*UnlockDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - /* Unseal unseal API */ diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go deleted file mode 100644 index 8fbc83bb..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudInternalLocationLink Link is used to uniquely reference any resource within HashiCorp Cloud. -// This can be conceptually considered a "foreign key". -// -// swagger:model hashicorp.cloud.internal.location.Link -type HashicorpCloudInternalLocationLink struct { - - // description is a human-friendly description for this link. This is - // used primarily for informational purposes such as error messages. - Description string `json:"description,omitempty"` - - // id is the ID of the resource. This may be a slug ID or a UUID depending on - // the resource, and as such has no guarantee that it is globally unique. If a - // globally unique identifier for the resource is required, refer to - // internal_id. - ID string `json:"id,omitempty"` - - // internal_id is a globally unique identifier for the resource. In the case - // that a resource has a user specifiable identifier, the internal_id will - // differ. - InternalID string `json:"internal_id,omitempty"` - - // location is the location where this resource is. - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` - - // type is the unique type of the resource. Each service publishes a - // unique set of types. The type value is recommended to be formatted - // in "." such as "hashicorp.hvn". This is to prevent conflicts - // in the future, but any string value will work. - Type string `json:"type,omitempty"` - - // uuid is being deprecated in favor of the id field. - UUID string `json:"uuid,omitempty"` -} - -// Validate validates this hashicorp cloud internal location link -func (m *HashicorpCloudInternalLocationLink) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudInternalLocationLink) validateLocation(formats strfmt.Registry) error { - if swag.IsZero(m.Location) { // not required - return nil - } - - if m.Location != nil { - if err := m.Location.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud internal location link based on the context it is used -func (m *HashicorpCloudInternalLocationLink) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudInternalLocationLink) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { - - if m.Location != nil { - if err := m.Location.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudInternalLocationLink) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudInternalLocationLink) UnmarshalBinary(b []byte) error { - var res HashicorpCloudInternalLocationLink - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go deleted file mode 100644 index 8c68a1bc..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go +++ /dev/null @@ -1,111 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudInternalLocationLocation Location represents a target for an operation in HCP. -// -// swagger:model hashicorp.cloud.internal.location.Location -type HashicorpCloudInternalLocationLocation struct { - - // organization_id is the id of the organization. - OrganizationID string `json:"organization_id,omitempty"` - - // project_id is the projects id. - ProjectID string `json:"project_id,omitempty"` - - // region is the region that the resource is located in. It is - // optional if the object being referenced is a global object. - Region *HashicorpCloudInternalLocationRegion `json:"region,omitempty"` -} - -// Validate validates this hashicorp cloud internal location location -func (m *HashicorpCloudInternalLocationLocation) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateRegion(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudInternalLocationLocation) validateRegion(formats strfmt.Registry) error { - if swag.IsZero(m.Region) { // not required - return nil - } - - if m.Region != nil { - if err := m.Region.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("region") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("region") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud internal location location based on the context it is used -func (m *HashicorpCloudInternalLocationLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateRegion(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudInternalLocationLocation) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { - - if m.Region != nil { - if err := m.Region.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("region") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("region") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudInternalLocationLocation) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudInternalLocationLocation) UnmarshalBinary(b []byte) error { - var res HashicorpCloudInternalLocationLocation - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go deleted file mode 100644 index 7f6a8a3e..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudInternalLocationRegion Region identifies a Cloud data-plane region. -// -// swagger:model hashicorp.cloud.internal.location.Region -type HashicorpCloudInternalLocationRegion struct { - - // provider is the named cloud provider ("aws", "gcp", "azure") - Provider string `json:"provider,omitempty"` - - // region is the cloud region ("us-west1", "us-east1") - Region string `json:"region,omitempty"` -} - -// Validate validates this hashicorp cloud internal location region -func (m *HashicorpCloudInternalLocationRegion) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hashicorp cloud internal location region based on context it is used -func (m *HashicorpCloudInternalLocationRegion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudInternalLocationRegion) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudInternalLocationRegion) UnmarshalBinary(b []byte) error { - var res HashicorpCloudInternalLocationRegion - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go index d1ee359c..7843f910 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go @@ -12,6 +12,7 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125AuditLog AuditLog represents a request for audit logs to download @@ -45,7 +46,7 @@ type HashicorpCloudVault20201125AuditLog struct { IntervalStart strfmt.DateTime `json:"interval_start,omitempty"` // location is the location of the cluster. - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // state is the current state of the download State *HashicorpCloudVault20201125AuditLogState `json:"state,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go index a6e1015e..c88a9f05 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go @@ -13,6 +13,7 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125Cluster Cluster represents a single Vault cluster. @@ -40,7 +41,7 @@ type HashicorpCloudVault20201125Cluster struct { ID string `json:"id,omitempty"` // location is the location of the cluster. - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // notifications is the list of notifications currently valid for the cluster. Notifications []*HashicorpCloudVault20201125ClusterNotification `json:"notifications"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go index 005aa78d..45ca7405 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go @@ -50,9 +50,6 @@ type HashicorpCloudVault20201125ClusterConfig struct { // vault config VaultConfig *HashicorpCloudVault20201125VaultConfig `json:"vault_config,omitempty"` - - // vault insights config - VaultInsightsConfig *HashicorpCloudVault20201125VaultInsightsConfig `json:"vault_insights_config,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 cluster config @@ -99,10 +96,6 @@ func (m *HashicorpCloudVault20201125ClusterConfig) Validate(formats strfmt.Regis res = append(res, err) } - if err := m.validateVaultInsightsConfig(formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -299,25 +292,6 @@ func (m *HashicorpCloudVault20201125ClusterConfig) validateVaultConfig(formats s return nil } -func (m *HashicorpCloudVault20201125ClusterConfig) validateVaultInsightsConfig(formats strfmt.Registry) error { - if swag.IsZero(m.VaultInsightsConfig) { // not required - return nil - } - - if m.VaultInsightsConfig != nil { - if err := m.VaultInsightsConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault_insights_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault_insights_config") - } - return err - } - } - - return nil -} - // ContextValidate validate this hashicorp cloud vault 20201125 cluster config based on the context it is used func (m *HashicorpCloudVault20201125ClusterConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -362,10 +336,6 @@ func (m *HashicorpCloudVault20201125ClusterConfig) ContextValidate(ctx context.C res = append(res, err) } - if err := m.contextValidateVaultInsightsConfig(ctx, formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -532,22 +502,6 @@ func (m *HashicorpCloudVault20201125ClusterConfig) contextValidateVaultConfig(ct return nil } -func (m *HashicorpCloudVault20201125ClusterConfig) contextValidateVaultInsightsConfig(ctx context.Context, formats strfmt.Registry) error { - - if m.VaultInsightsConfig != nil { - if err := m.VaultInsightsConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault_insights_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault_insights_config") - } - return err - } - } - - return nil -} - // MarshalBinary interface implementation func (m *HashicorpCloudVault20201125ClusterConfig) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go index 5ca2cfbb..20ffebe4 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125ClusterPerformanceReplicationInfo PerformanceReplicationInfo holds Performance Replication information @@ -28,7 +29,7 @@ type HashicorpCloudVault20201125ClusterPerformanceReplicationInfo struct { // primary_cluster_link holds the link information of the // primary cluster to which the current cluster is replicated to. This field // only applies when the cluster is a Secondary under Cluster Performance Replication. - PrimaryClusterLink *HashicorpCloudInternalLocationLink `json:"primary_cluster_link,omitempty"` + PrimaryClusterLink *cloud.HashicorpCloudLocationLink `json:"primary_cluster_link,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 cluster performance replication info diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go index 97bebd84..66c1ddea 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go @@ -34,13 +34,13 @@ import ( // update. // - RESTORING: RESTORING is the state the cluster is in while restoring from a snapshot. // - DELETING: DELETING is the state the cluster is in while it is being de-provisioned. +// - DELETED: DELETED is the state the cluster is in when it has been de-provisioned. At +// +// this point, the cluster is eligible for garbage collection. // - SEALING: SEALING is the state the cluster is in when it is about to get sealed. // - SEALED: SEALED is the state the cluster is in while a cluster is sealed. // - UNSEALING: UNSEALING is the state the cluster is in when it is about to get unsealed. // - CLUSTER_SCALING: CLUSTER_SCALING is the state the cluster is in when it is under an up or down scaling operation to a new tier_size state. -// - LOCKING: LOCKING is the state the cluster is in when it is about to get locked. -// - LOCKED: LOCKED is the state the cluster is in while a cluster is locked. -// - UNLOCKING: UNLOCKING is the state the cluster is in when it is about to get unlocked. // // swagger:model hashicorp.cloud.vault_20201125.Cluster.State type HashicorpCloudVault20201125ClusterState string @@ -80,6 +80,9 @@ const ( // HashicorpCloudVault20201125ClusterStateDELETING captures enum value "DELETING" HashicorpCloudVault20201125ClusterStateDELETING HashicorpCloudVault20201125ClusterState = "DELETING" + // HashicorpCloudVault20201125ClusterStateDELETED captures enum value "DELETED" + HashicorpCloudVault20201125ClusterStateDELETED HashicorpCloudVault20201125ClusterState = "DELETED" + // HashicorpCloudVault20201125ClusterStateSEALING captures enum value "SEALING" HashicorpCloudVault20201125ClusterStateSEALING HashicorpCloudVault20201125ClusterState = "SEALING" @@ -91,15 +94,6 @@ const ( // HashicorpCloudVault20201125ClusterStateCLUSTERSCALING captures enum value "CLUSTER_SCALING" HashicorpCloudVault20201125ClusterStateCLUSTERSCALING HashicorpCloudVault20201125ClusterState = "CLUSTER_SCALING" - - // HashicorpCloudVault20201125ClusterStateLOCKING captures enum value "LOCKING" - HashicorpCloudVault20201125ClusterStateLOCKING HashicorpCloudVault20201125ClusterState = "LOCKING" - - // HashicorpCloudVault20201125ClusterStateLOCKED captures enum value "LOCKED" - HashicorpCloudVault20201125ClusterStateLOCKED HashicorpCloudVault20201125ClusterState = "LOCKED" - - // HashicorpCloudVault20201125ClusterStateUNLOCKING captures enum value "UNLOCKING" - HashicorpCloudVault20201125ClusterStateUNLOCKING HashicorpCloudVault20201125ClusterState = "UNLOCKING" ) // for schema @@ -107,7 +101,7 @@ var hashicorpCloudVault20201125ClusterStateEnum []interface{} func init() { var res []HashicorpCloudVault20201125ClusterState - if err := json.Unmarshal([]byte(`["CLUSTER_STATE_INVALID","PENDING","CREATING","RUNNING","FAILED","UPDATING","RESTORING","DELETING","SEALING","SEALED","UNSEALING","CLUSTER_SCALING","LOCKING","LOCKED","UNLOCKING"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["CLUSTER_STATE_INVALID","PENDING","CREATING","RUNNING","FAILED","UPDATING","RESTORING","DELETING","DELETED","SEALING","SEALED","UNSEALING","CLUSTER_SCALING"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go index ae936a7d..e5c252ed 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125CreateSnapshotRequest hashicorp cloud vault 20201125 create snapshot request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125CreateSnapshotRequest struct { Name string `json:"name,omitempty"` // resource specifies the link to the resource to snapshot - Resource *HashicorpCloudInternalLocationLink `json:"resource,omitempty"` + Resource *cloud.HashicorpCloudLocationLink `json:"resource,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 create snapshot request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go deleted file mode 100644 index de3571fa..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125DeleteSentinelPolicyRequest hashicorp cloud vault 20201125 delete sentinel policy request -// -// swagger:model hashicorp.cloud.vault_20201125.DeleteSentinelPolicyRequest -type HashicorpCloudVault20201125DeleteSentinelPolicyRequest struct { - - // cluster id - ClusterID string `json:"cluster_id,omitempty"` - - // egp policy - EgpPolicy []string `json:"egp_policy"` - - // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` - - // namespace - Namespace string `json:"namespace,omitempty"` - - // rgp policy - RgpPolicy []string `json:"rgp_policy"` -} - -// Validate validates this hashicorp cloud vault 20201125 delete sentinel policy request -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) validateLocation(formats strfmt.Registry) error { - if swag.IsZero(m.Location) { // not required - return nil - } - - if m.Location != nil { - if err := m.Location.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 delete sentinel policy request based on the context it is used -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { - - if m.Location != nil { - if err := m.Location.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125DeleteSentinelPolicyRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go deleted file mode 100644 index 8d36f8ad..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" -) - -// HashicorpCloudVault20201125DeleteSentinelPolicyResponse hashicorp cloud vault 20201125 delete sentinel policy response -// -// swagger:model hashicorp.cloud.vault_20201125.DeleteSentinelPolicyResponse -type HashicorpCloudVault20201125DeleteSentinelPolicyResponse struct { - - // operation - Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 delete sentinel policy response -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateOperation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) validateOperation(formats strfmt.Registry) error { - if swag.IsZero(m.Operation) { // not required - return nil - } - - if m.Operation != nil { - if err := m.Operation.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 delete sentinel policy response based on the context it is used -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateOperation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { - - if m.Operation != nil { - if err := m.Operation.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125DeleteSentinelPolicyResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go index fd5bc472..d8f83a77 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go @@ -5,101 +5,7 @@ package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" -) - // HashicorpCloudVault20201125DeregisterLinkedClusterResponse hashicorp cloud vault 20201125 deregister linked cluster response // // swagger:model hashicorp.cloud.vault_20201125.DeregisterLinkedClusterResponse -type HashicorpCloudVault20201125DeregisterLinkedClusterResponse struct { - - // operation - Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 deregister linked cluster response -func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateOperation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) validateOperation(formats strfmt.Registry) error { - if swag.IsZero(m.Operation) { // not required - return nil - } - - if m.Operation != nil { - if err := m.Operation.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 deregister linked cluster response based on the context it is used -func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateOperation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { - - if m.Operation != nil { - if err := m.Operation.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125DeregisterLinkedClusterResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} +type HashicorpCloudVault20201125DeregisterLinkedClusterResponse interface{} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go index 0c0c8c06..2d3682b8 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go @@ -12,6 +12,7 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125FetchAuditLogRequest hashicorp cloud vault 20201125 fetch audit log request @@ -31,7 +32,7 @@ type HashicorpCloudVault20201125FetchAuditLogRequest struct { IntervalStart strfmt.DateTime `json:"interval_start,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 fetch audit log request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go deleted file mode 100644 index 87e21fbd..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125GetAvailableTemplatesResponse hashicorp cloud vault 20201125 get available templates response -// -// swagger:model hashicorp.cloud.vault_20201125.GetAvailableTemplatesResponse -type HashicorpCloudVault20201125GetAvailableTemplatesResponse struct { - - // templates is a list of available templates. - Templates []*HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate `json:"templates"` -} - -// Validate validates this hashicorp cloud vault 20201125 get available templates response -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateTemplates(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) validateTemplates(formats strfmt.Registry) error { - if swag.IsZero(m.Templates) { // not required - return nil - } - - for i := 0; i < len(m.Templates); i++ { - if swag.IsZero(m.Templates[i]) { // not required - continue - } - - if m.Templates[i] != nil { - if err := m.Templates[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("templates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("templates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 get available templates response based on the context it is used -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateTemplates(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) contextValidateTemplates(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Templates); i++ { - - if m.Templates[i] != nil { - if err := m.Templates[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("templates" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("templates" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125GetAvailableTemplatesResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go deleted file mode 100644 index d1d3f954..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate hashicorp cloud vault 20201125 get available templates response template -// -// swagger:model hashicorp.cloud.vault_20201125.GetAvailableTemplatesResponse.Template -type HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate struct { - - // id - ID string `json:"id,omitempty"` - - // is beta - IsBeta bool `json:"is_beta,omitempty"` - - // name - Name string `json:"name,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 get available templates response template -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 get available templates response template based on context it is used -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go new file mode 100644 index 00000000..94c5d691 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125GetLinkedClusterPolicyResponse hashicorp cloud vault 20201125 get linked cluster policy response +// +// swagger:model hashicorp.cloud.vault_20201125.GetLinkedClusterPolicyResponse +type HashicorpCloudVault20201125GetLinkedClusterPolicyResponse struct { + + // policy refers to the HCL formatted policy + Policy string `json:"policy,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 get linked cluster policy response +func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 get linked cluster policy response based on context it is used +func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125GetLinkedClusterPolicyResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go index 6f73be1f..6d196d63 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125InputCluster hashicorp cloud vault 20201125 input cluster @@ -25,7 +26,7 @@ type HashicorpCloudVault20201125InputCluster struct { ID string `json:"id,omitempty"` // location is the location of the cluster. - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // performance_replication_paths_filter is the information about what paths should be // filtered for a performance replication secondary. @@ -33,7 +34,7 @@ type HashicorpCloudVault20201125InputCluster struct { // performance_replication_primary_cluster holds the link information of the // primary cluster under performance replication. - PerformanceReplicationPrimaryCluster *HashicorpCloudInternalLocationLink `json:"performance_replication_primary_cluster,omitempty"` + PerformanceReplicationPrimaryCluster *cloud.HashicorpCloudLocationLink `json:"performance_replication_primary_cluster,omitempty"` // template_input refers to the template used to create the cluster that will be applied during bootstrap time. TemplateInput *HashicorpCloudVault20201125InputClusterTemplateInput `json:"template_input,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go index 672181e9..1cc0e5b2 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go @@ -32,9 +32,6 @@ type HashicorpCloudVault20201125InputClusterConfig struct { // vault_config is the Vault specific configuration VaultConfig *HashicorpCloudVault20201125VaultConfig `json:"vault_config,omitempty"` - - // vault_insights_config is the configuration for Vault Insights audit-log streaming - VaultInsightsConfig *HashicorpCloudVault20201125InputVaultInsightsConfig `json:"vault_insights_config,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 input cluster config @@ -61,10 +58,6 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) Validate(formats strfmt. res = append(res, err) } - if err := m.validateVaultInsightsConfig(formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -166,25 +159,6 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) validateVaultConfig(form return nil } -func (m *HashicorpCloudVault20201125InputClusterConfig) validateVaultInsightsConfig(formats strfmt.Registry) error { - if swag.IsZero(m.VaultInsightsConfig) { // not required - return nil - } - - if m.VaultInsightsConfig != nil { - if err := m.VaultInsightsConfig.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault_insights_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault_insights_config") - } - return err - } - } - - return nil -} - // ContextValidate validate this hashicorp cloud vault 20201125 input cluster config based on the context it is used func (m *HashicorpCloudVault20201125InputClusterConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -209,10 +183,6 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) ContextValidate(ctx cont res = append(res, err) } - if err := m.contextValidateVaultInsightsConfig(ctx, formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -299,22 +269,6 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) contextValidateVaultConf return nil } -func (m *HashicorpCloudVault20201125InputClusterConfig) contextValidateVaultInsightsConfig(ctx context.Context, formats strfmt.Registry) error { - - if m.VaultInsightsConfig != nil { - if err := m.VaultInsightsConfig.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("vault_insights_config") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("vault_insights_config") - } - return err - } - } - - return nil -} - // MarshalBinary interface implementation func (m *HashicorpCloudVault20201125InputClusterConfig) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go deleted file mode 100644 index 98da38ad..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125InputVaultInsightsConfig hashicorp cloud vault 20201125 input vault insights config -// -// swagger:model hashicorp.cloud.vault_20201125.InputVaultInsightsConfig -type HashicorpCloudVault20201125InputVaultInsightsConfig struct { - - // enabled controls the streaming of audit logs to Vault Insights - Enabled bool `json:"enabled,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 input vault insights config -func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 input vault insights config based on context it is used -func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125InputVaultInsightsConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go deleted file mode 100644 index 0091d5b7..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go +++ /dev/null @@ -1,116 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125IsVaultPluginRegisteredRequest hashicorp cloud vault 20201125 is vault plugin registered request -// -// swagger:model hashicorp.cloud.vault_20201125.IsVaultPluginRegisteredRequest -type HashicorpCloudVault20201125IsVaultPluginRegisteredRequest struct { - - // cluster id - ClusterID string `json:"cluster_id,omitempty"` - - // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` - - // plugin name - PluginName string `json:"plugin_name,omitempty"` - - // plugin type - PluginType string `json:"plugin_type,omitempty"` - - // plugin version - PluginVersion string `json:"plugin_version,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 is vault plugin registered request -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) validateLocation(formats strfmt.Registry) error { - if swag.IsZero(m.Location) { // not required - return nil - } - - if m.Location != nil { - if err := m.Location.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 is vault plugin registered request based on the context it is used -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { - - if m.Location != nil { - if err := m.Location.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125IsVaultPluginRegisteredRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go deleted file mode 100644 index dc092fc5..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125IsVaultPluginRegisteredResponse hashicorp cloud vault 20201125 is vault plugin registered response -// -// swagger:model hashicorp.cloud.vault_20201125.IsVaultPluginRegisteredResponse -type HashicorpCloudVault20201125IsVaultPluginRegisteredResponse struct { - - // is registered - IsRegistered bool `json:"is_registered,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 is vault plugin registered response -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 is vault plugin registered response based on context it is used -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125IsVaultPluginRegisteredResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go index afba80a9..83877ac9 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go @@ -7,12 +7,12 @@ package models import ( "context" - "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125LinkedCluster hashicorp cloud vault 20201125 linked cluster @@ -20,61 +20,30 @@ import ( // swagger:model hashicorp.cloud.vault_20201125.LinkedCluster type HashicorpCloudVault20201125LinkedCluster struct { - // autopilot enabled - AutopilotEnabled bool `json:"autopilot_enabled,omitempty"` - - // cluster name - ClusterName string `json:"cluster_name,omitempty"` - - // created at - // Format: date-time - CreatedAt strfmt.DateTime `json:"created_at,omitempty"` - // current version CurrentVersion string `json:"current_version,omitempty"` - // ha enabled - HaEnabled bool `json:"ha_enabled,omitempty"` - // id ID string `json:"id,omitempty"` // internal id InternalID string `json:"internal_id,omitempty"` - // we don't support this since we cannot determine when a cluster is completely sealed - // due to not having access to the total number of nodes in a cluster when all connected nodes - // are sealed, including the active one. - IsSealed bool `json:"is_sealed,omitempty"` - // linked at // Format: date-time LinkedAt strfmt.DateTime `json:"linked_at,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` - - // this will be later changed/replaced by "nodes." - NodeStatuses []*HashicorpCloudVault20201125LinkedClusterNode `json:"node_statuses"` - - // raft quorum status - RaftQuorumStatus *HashicorpCloudVault20201125RaftQuorumStatus `json:"raft_quorum_status,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // state State *HashicorpCloudVault20201125LinkedClusterState `json:"state,omitempty"` - - // storage type - StorageType string `json:"storage_type,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 linked cluster func (m *HashicorpCloudVault20201125LinkedCluster) Validate(formats strfmt.Registry) error { var res []error - if err := m.validateCreatedAt(formats); err != nil { - res = append(res, err) - } - if err := m.validateLinkedAt(formats); err != nil { res = append(res, err) } @@ -83,14 +52,6 @@ func (m *HashicorpCloudVault20201125LinkedCluster) Validate(formats strfmt.Regis res = append(res, err) } - if err := m.validateNodeStatuses(formats); err != nil { - res = append(res, err) - } - - if err := m.validateRaftQuorumStatus(formats); err != nil { - res = append(res, err) - } - if err := m.validateState(formats); err != nil { res = append(res, err) } @@ -101,18 +62,6 @@ func (m *HashicorpCloudVault20201125LinkedCluster) Validate(formats strfmt.Regis return nil } -func (m *HashicorpCloudVault20201125LinkedCluster) validateCreatedAt(formats strfmt.Registry) error { - if swag.IsZero(m.CreatedAt) { // not required - return nil - } - - if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { - return err - } - - return nil -} - func (m *HashicorpCloudVault20201125LinkedCluster) validateLinkedAt(formats strfmt.Registry) error { if swag.IsZero(m.LinkedAt) { // not required return nil @@ -144,51 +93,6 @@ func (m *HashicorpCloudVault20201125LinkedCluster) validateLocation(formats strf return nil } -func (m *HashicorpCloudVault20201125LinkedCluster) validateNodeStatuses(formats strfmt.Registry) error { - if swag.IsZero(m.NodeStatuses) { // not required - return nil - } - - for i := 0; i < len(m.NodeStatuses); i++ { - if swag.IsZero(m.NodeStatuses[i]) { // not required - continue - } - - if m.NodeStatuses[i] != nil { - if err := m.NodeStatuses[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("node_statuses" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("node_statuses" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedCluster) validateRaftQuorumStatus(formats strfmt.Registry) error { - if swag.IsZero(m.RaftQuorumStatus) { // not required - return nil - } - - if m.RaftQuorumStatus != nil { - if err := m.RaftQuorumStatus.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("raft_quorum_status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("raft_quorum_status") - } - return err - } - } - - return nil -} - func (m *HashicorpCloudVault20201125LinkedCluster) validateState(formats strfmt.Registry) error { if swag.IsZero(m.State) { // not required return nil @@ -216,14 +120,6 @@ func (m *HashicorpCloudVault20201125LinkedCluster) ContextValidate(ctx context.C res = append(res, err) } - if err := m.contextValidateNodeStatuses(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateRaftQuorumStatus(ctx, formats); err != nil { - res = append(res, err) - } - if err := m.contextValidateState(ctx, formats); err != nil { res = append(res, err) } @@ -250,42 +146,6 @@ func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateLocation(ctx c return nil } -func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateNodeStatuses(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.NodeStatuses); i++ { - - if m.NodeStatuses[i] != nil { - if err := m.NodeStatuses[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("node_statuses" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("node_statuses" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateRaftQuorumStatus(ctx context.Context, formats strfmt.Registry) error { - - if m.RaftQuorumStatus != nil { - if err := m.RaftQuorumStatus.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("raft_quorum_status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("raft_quorum_status") - } - return err - } - } - - return nil -} - func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateState(ctx context.Context, formats strfmt.Registry) error { if m.State != nil { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go deleted file mode 100644 index d2e5c203..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go +++ /dev/null @@ -1,293 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125LinkedClusterNode hashicorp cloud vault 20201125 linked cluster node -// -// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode -type HashicorpCloudVault20201125LinkedClusterNode struct { - - // alternative_versions is a list of versions that should also be considered for - // an update as they might come with additional improvements and features. - AlternativeVersions []string `json:"alternative_versions"` - - // current_version is the node's current version in semantic version format. - CurrentVersion string `json:"current_version,omitempty"` - - // has_security_flaw will be true if the current version has a security flaw. - HasSecurityFlaws bool `json:"has_security_flaws,omitempty"` - - // hostname is the hostname of the node. - Hostname string `json:"hostname,omitempty"` - - // leader_status is the leader status of the node. - LeaderStatus *HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus `json:"leader_status,omitempty"` - - // listener_addresses is a list of listener addresses for the node. - ListenerAddresses []string `json:"listener_addresses"` - - // log_level is the log level of the node. - LogLevel *HashicorpCloudVault20201125LinkedClusterNodeLogLevel `json:"log_level,omitempty"` - - // node_binary_architecture is the lower-case architecture of the client binary - // (e.g. amd64, arm, ...). - NodeBinaryArchitecture string `json:"node_binary_architecture,omitempty"` - - // node_id is the node identification. - NodeID string `json:"node_id,omitempty"` - - // node_initialized indicates if the node has been initialized. - NodeInitialized bool `json:"node_initialized,omitempty"` - - // node_os is the lower-case name of the operating system platform the client is - // running on (e.g. ubuntu). - NodeOs string `json:"node_os,omitempty"` - - // node_os_version is the lower-case name of the operating system platform version the client is - // running on (e.g. 22.04). - NodeOsVersion string `json:"node_os_version,omitempty"` - - // node_sealed indicates if the node is sealed. - NodeSealed bool `json:"node_sealed,omitempty"` - - // node_state is the HCP state of the node (linking, linked, unliking, or unlinked). - NodeState *HashicorpCloudVault20201125LinkedClusterNodeState `json:"node_state,omitempty"` - - // node_type indicates the node type. - NodeType string `json:"node_type,omitempty"` - - // recommended_version is the version the product should ideally be updated to. - RecommendedVersion string `json:"recommended_version,omitempty"` - - // status is the status of the current version. The status may help to - // determine the urgency of the update. - Status *HashicorpCloudVault20201125LinkedClusterNodeVersionStatus `json:"status,omitempty"` - - // status_version is the version of the status message format. To ensure - // that the version is not omitted by accident the initial version is 1. - StatusVersion int64 `json:"status_version,omitempty"` - - // storage_type is the storage type of the node. - StorageType string `json:"storage_type,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 linked cluster node -func (m *HashicorpCloudVault20201125LinkedClusterNode) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLeaderStatus(formats); err != nil { - res = append(res, err) - } - - if err := m.validateLogLevel(formats); err != nil { - res = append(res, err) - } - - if err := m.validateNodeState(formats); err != nil { - res = append(res, err) - } - - if err := m.validateStatus(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) validateLeaderStatus(formats strfmt.Registry) error { - if swag.IsZero(m.LeaderStatus) { // not required - return nil - } - - if m.LeaderStatus != nil { - if err := m.LeaderStatus.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("leader_status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("leader_status") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) validateLogLevel(formats strfmt.Registry) error { - if swag.IsZero(m.LogLevel) { // not required - return nil - } - - if m.LogLevel != nil { - if err := m.LogLevel.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("log_level") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("log_level") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) validateNodeState(formats strfmt.Registry) error { - if swag.IsZero(m.NodeState) { // not required - return nil - } - - if m.NodeState != nil { - if err := m.NodeState.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("node_state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("node_state") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) validateStatus(formats strfmt.Registry) error { - if swag.IsZero(m.Status) { // not required - return nil - } - - if m.Status != nil { - if err := m.Status.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 linked cluster node based on the context it is used -func (m *HashicorpCloudVault20201125LinkedClusterNode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLeaderStatus(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateLogLevel(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateNodeState(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateStatus(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateLeaderStatus(ctx context.Context, formats strfmt.Registry) error { - - if m.LeaderStatus != nil { - if err := m.LeaderStatus.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("leader_status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("leader_status") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateLogLevel(ctx context.Context, formats strfmt.Registry) error { - - if m.LogLevel != nil { - if err := m.LogLevel.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("log_level") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("log_level") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateNodeState(ctx context.Context, formats strfmt.Registry) error { - - if m.NodeState != nil { - if err := m.NodeState.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("node_state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("node_state") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { - - if m.Status != nil { - if err := m.Status.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("status") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("status") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125LinkedClusterNode) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125LinkedClusterNode) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125LinkedClusterNode - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go deleted file mode 100644 index fecf3506..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus - LEADER: Deprecated values -// - ACTIVE: Valid values -// -// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.LeaderStatus -type HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus string - -func NewHashicorpCloudVault20201125LinkedClusterNodeLeaderStatus(value HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) *HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus { - return &value -} - -// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus. -func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus { - return &m -} - -const ( - - // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADERSTATUSCLUSTERSTATEINVALID captures enum value "LEADER_STATUS_CLUSTER_STATE_INVALID" - HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADERSTATUSCLUSTERSTATEINVALID HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "LEADER_STATUS_CLUSTER_STATE_INVALID" - - // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADER captures enum value "LEADER" - HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADER HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "LEADER" - - // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusFOLLOWER captures enum value "FOLLOWER" - HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusFOLLOWER HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "FOLLOWER" - - // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusACTIVE captures enum value "ACTIVE" - HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusACTIVE HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "ACTIVE" - - // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusSTANDBY captures enum value "STANDBY" - HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusSTANDBY HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "STANDBY" - - // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusPERFSTANDBY captures enum value "PERF_STANDBY" - HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusPERFSTANDBY HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "PERF_STANDBY" -) - -// for schema -var hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum []interface{} - -func init() { - var res []HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus - if err := json.Unmarshal([]byte(`["LEADER_STATUS_CLUSTER_STATE_INVALID","LEADER","FOLLOWER","ACTIVE","STANDBY","PERF_STANDBY"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum = append(hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum, v) - } -} - -func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) validateHashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) error { - if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this hashicorp cloud vault 20201125 linked cluster node leader status -func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node leader status based on context it is used -func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go deleted file mode 100644 index fd35240a..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// HashicorpCloudVault20201125LinkedClusterNodeLogLevel hashicorp cloud vault 20201125 linked cluster node log level -// -// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.LogLevel -type HashicorpCloudVault20201125LinkedClusterNodeLogLevel string - -func NewHashicorpCloudVault20201125LinkedClusterNodeLogLevel(value HashicorpCloudVault20201125LinkedClusterNodeLogLevel) *HashicorpCloudVault20201125LinkedClusterNodeLogLevel { - return &value -} - -// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeLogLevel. -func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeLogLevel { - return &m -} - -const ( - - // HashicorpCloudVault20201125LinkedClusterNodeLogLevelLOGLEVELCLUSTERSTATEINVALID captures enum value "LOG_LEVEL_CLUSTER_STATE_INVALID" - HashicorpCloudVault20201125LinkedClusterNodeLogLevelLOGLEVELCLUSTERSTATEINVALID HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "LOG_LEVEL_CLUSTER_STATE_INVALID" - - // HashicorpCloudVault20201125LinkedClusterNodeLogLevelTRACE captures enum value "TRACE" - HashicorpCloudVault20201125LinkedClusterNodeLogLevelTRACE HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "TRACE" - - // HashicorpCloudVault20201125LinkedClusterNodeLogLevelDEBUG captures enum value "DEBUG" - HashicorpCloudVault20201125LinkedClusterNodeLogLevelDEBUG HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "DEBUG" - - // HashicorpCloudVault20201125LinkedClusterNodeLogLevelINFO captures enum value "INFO" - HashicorpCloudVault20201125LinkedClusterNodeLogLevelINFO HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "INFO" - - // HashicorpCloudVault20201125LinkedClusterNodeLogLevelWARN captures enum value "WARN" - HashicorpCloudVault20201125LinkedClusterNodeLogLevelWARN HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "WARN" - - // HashicorpCloudVault20201125LinkedClusterNodeLogLevelERROR captures enum value "ERROR" - HashicorpCloudVault20201125LinkedClusterNodeLogLevelERROR HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "ERROR" -) - -// for schema -var hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum []interface{} - -func init() { - var res []HashicorpCloudVault20201125LinkedClusterNodeLogLevel - if err := json.Unmarshal([]byte(`["LOG_LEVEL_CLUSTER_STATE_INVALID","TRACE","DEBUG","INFO","WARN","ERROR"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum = append(hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum, v) - } -} - -func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) validateHashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeLogLevel) error { - if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this hashicorp cloud vault 20201125 linked cluster node log level -func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node log level based on context it is used -func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go deleted file mode 100644 index dd88b65d..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go +++ /dev/null @@ -1,87 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// HashicorpCloudVault20201125LinkedClusterNodeState hashicorp cloud vault 20201125 linked cluster node state -// -// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.State -type HashicorpCloudVault20201125LinkedClusterNodeState string - -func NewHashicorpCloudVault20201125LinkedClusterNodeState(value HashicorpCloudVault20201125LinkedClusterNodeState) *HashicorpCloudVault20201125LinkedClusterNodeState { - return &value -} - -// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeState. -func (m HashicorpCloudVault20201125LinkedClusterNodeState) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeState { - return &m -} - -const ( - - // HashicorpCloudVault20201125LinkedClusterNodeStateLINKEDCLUSTERSTATEINVALID captures enum value "LINKED_CLUSTER_STATE_INVALID" - HashicorpCloudVault20201125LinkedClusterNodeStateLINKEDCLUSTERSTATEINVALID HashicorpCloudVault20201125LinkedClusterNodeState = "LINKED_CLUSTER_STATE_INVALID" - - // HashicorpCloudVault20201125LinkedClusterNodeStateLINKING captures enum value "LINKING" - HashicorpCloudVault20201125LinkedClusterNodeStateLINKING HashicorpCloudVault20201125LinkedClusterNodeState = "LINKING" - - // HashicorpCloudVault20201125LinkedClusterNodeStateLINKED captures enum value "LINKED" - HashicorpCloudVault20201125LinkedClusterNodeStateLINKED HashicorpCloudVault20201125LinkedClusterNodeState = "LINKED" - - // HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKING captures enum value "UNLINKING" - HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKING HashicorpCloudVault20201125LinkedClusterNodeState = "UNLINKING" - - // HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKED captures enum value "UNLINKED" - HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKED HashicorpCloudVault20201125LinkedClusterNodeState = "UNLINKED" -) - -// for schema -var hashicorpCloudVault20201125LinkedClusterNodeStateEnum []interface{} - -func init() { - var res []HashicorpCloudVault20201125LinkedClusterNodeState - if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","UNLINKING","UNLINKED"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - hashicorpCloudVault20201125LinkedClusterNodeStateEnum = append(hashicorpCloudVault20201125LinkedClusterNodeStateEnum, v) - } -} - -func (m HashicorpCloudVault20201125LinkedClusterNodeState) validateHashicorpCloudVault20201125LinkedClusterNodeStateEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeState) error { - if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeStateEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this hashicorp cloud vault 20201125 linked cluster node state -func (m HashicorpCloudVault20201125LinkedClusterNodeState) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeStateEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node state based on context it is used -func (m HashicorpCloudVault20201125LinkedClusterNodeState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go deleted file mode 100644 index d3bf585b..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go +++ /dev/null @@ -1,90 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// HashicorpCloudVault20201125LinkedClusterNodeVersionStatus - VERSION_UP_TO_DATE: VERSION_UP_TO_DATE is used when node is running the latest Vault Version. -// - UPGRADE_AVAILABLE: UPGRADE_AVAILABLE is used when node is running the latest minor release of a Vault Version, but there is a new major Vault version available for upgrade. -// - UPGRADE_RECOMMENDED: UPGRADE_RECOMMENDED is used when node is running an outdated but still supported version, but there is a new minor or major Vault versions available for upgrade. -// - UPGRADE_REQUIRED: UPGRADE_REQUIRED is used when node is running a no longer supported version and there are minor and major versions available for upgrade. -// -// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.VersionStatus -type HashicorpCloudVault20201125LinkedClusterNodeVersionStatus string - -func NewHashicorpCloudVault20201125LinkedClusterNodeVersionStatus(value HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) *HashicorpCloudVault20201125LinkedClusterNodeVersionStatus { - return &value -} - -// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeVersionStatus. -func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeVersionStatus { - return &m -} - -const ( - - // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusLINKEDCLUSTERNODEVERSIONSTATUSINVALID captures enum value "LINKED_CLUSTER_NODE_VERSION_STATUS_INVALID" - HashicorpCloudVault20201125LinkedClusterNodeVersionStatusLINKEDCLUSTERNODEVERSIONSTATUSINVALID HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "LINKED_CLUSTER_NODE_VERSION_STATUS_INVALID" - - // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusVERSIONUPTODATE captures enum value "VERSION_UP_TO_DATE" - HashicorpCloudVault20201125LinkedClusterNodeVersionStatusVERSIONUPTODATE HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "VERSION_UP_TO_DATE" - - // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEAVAILABLE captures enum value "UPGRADE_AVAILABLE" - HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEAVAILABLE HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "UPGRADE_AVAILABLE" - - // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADERECOMMENDED captures enum value "UPGRADE_RECOMMENDED" - HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADERECOMMENDED HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "UPGRADE_RECOMMENDED" - - // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEREQUIRED captures enum value "UPGRADE_REQUIRED" - HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEREQUIRED HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "UPGRADE_REQUIRED" -) - -// for schema -var hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum []interface{} - -func init() { - var res []HashicorpCloudVault20201125LinkedClusterNodeVersionStatus - if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_NODE_VERSION_STATUS_INVALID","VERSION_UP_TO_DATE","UPGRADE_AVAILABLE","UPGRADE_RECOMMENDED","UPGRADE_REQUIRED"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum = append(hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum, v) - } -} - -func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) validateHashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) error { - if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this hashicorp cloud vault 20201125 linked cluster node version status -func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node version status based on context it is used -func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go index cc231024..2a2cd384 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go @@ -39,6 +39,9 @@ const ( // HashicorpCloudVault20201125LinkedClusterStateLINKED captures enum value "LINKED" HashicorpCloudVault20201125LinkedClusterStateLINKED HashicorpCloudVault20201125LinkedClusterState = "LINKED" + // HashicorpCloudVault20201125LinkedClusterStateSEALED captures enum value "SEALED" + HashicorpCloudVault20201125LinkedClusterStateSEALED HashicorpCloudVault20201125LinkedClusterState = "SEALED" + // HashicorpCloudVault20201125LinkedClusterStateUNLINKING captures enum value "UNLINKING" HashicorpCloudVault20201125LinkedClusterStateUNLINKING HashicorpCloudVault20201125LinkedClusterState = "UNLINKING" @@ -51,7 +54,7 @@ var hashicorpCloudVault20201125LinkedClusterStateEnum []interface{} func init() { var res []HashicorpCloudVault20201125LinkedClusterState - if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","UNLINKING","UNLINKED"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","SEALED","UNLINKING","UNLINKED"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go deleted file mode 100644 index 986dca86..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go +++ /dev/null @@ -1,163 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" -) - -// HashicorpCloudVault20201125ListAllClustersResponse hashicorp cloud vault 20201125 list all clusters response -// -// swagger:model hashicorp.cloud.vault_20201125.ListAllClustersResponse -type HashicorpCloudVault20201125ListAllClustersResponse struct { - - // clusters - Clusters []*HashicorpCloudVault20201125ListAllClustersResponseVaultCluster `json:"clusters"` - - // pagination - Pagination *cloud.HashicorpCloudCommonPaginationResponse `json:"pagination,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 list all clusters response -func (m *HashicorpCloudVault20201125ListAllClustersResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateClusters(formats); err != nil { - res = append(res, err) - } - - if err := m.validatePagination(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponse) validateClusters(formats strfmt.Registry) error { - if swag.IsZero(m.Clusters) { // not required - return nil - } - - for i := 0; i < len(m.Clusters); i++ { - if swag.IsZero(m.Clusters[i]) { // not required - continue - } - - if m.Clusters[i] != nil { - if err := m.Clusters[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("clusters" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponse) validatePagination(formats strfmt.Registry) error { - if swag.IsZero(m.Pagination) { // not required - return nil - } - - if m.Pagination != nil { - if err := m.Pagination.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagination") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagination") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 list all clusters response based on the context it is used -func (m *HashicorpCloudVault20201125ListAllClustersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateClusters(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidatePagination(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponse) contextValidateClusters(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Clusters); i++ { - - if m.Clusters[i] != nil { - if err := m.Clusters[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("clusters" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponse) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { - - if m.Pagination != nil { - if err := m.Pagination.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("pagination") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("pagination") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125ListAllClustersResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125ListAllClustersResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125ListAllClustersResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go deleted file mode 100644 index 7356c195..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go +++ /dev/null @@ -1,150 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125ListAllClustersResponseVaultCluster hashicorp cloud vault 20201125 list all clusters response vault cluster -// -// swagger:model hashicorp.cloud.vault_20201125.ListAllClustersResponse.VaultCluster -type HashicorpCloudVault20201125ListAllClustersResponseVaultCluster struct { - - // linked cluster - LinkedCluster *HashicorpCloudVault20201125LinkedCluster `json:"linked_cluster,omitempty"` - - // managed cluster - ManagedCluster *HashicorpCloudVault20201125Cluster `json:"managed_cluster,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 list all clusters response vault cluster -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLinkedCluster(formats); err != nil { - res = append(res, err) - } - - if err := m.validateManagedCluster(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) validateLinkedCluster(formats strfmt.Registry) error { - if swag.IsZero(m.LinkedCluster) { // not required - return nil - } - - if m.LinkedCluster != nil { - if err := m.LinkedCluster.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("linked_cluster") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("linked_cluster") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) validateManagedCluster(formats strfmt.Registry) error { - if swag.IsZero(m.ManagedCluster) { // not required - return nil - } - - if m.ManagedCluster != nil { - if err := m.ManagedCluster.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("managed_cluster") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("managed_cluster") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 list all clusters response vault cluster based on the context it is used -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLinkedCluster(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateManagedCluster(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) contextValidateLinkedCluster(ctx context.Context, formats strfmt.Registry) error { - - if m.LinkedCluster != nil { - if err := m.LinkedCluster.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("linked_cluster") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("linked_cluster") - } - return err - } - } - - return nil -} - -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) contextValidateManagedCluster(ctx context.Context, formats strfmt.Registry) error { - - if m.ManagedCluster != nil { - if err := m.ManagedCluster.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("managed_cluster") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("managed_cluster") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125ListAllClustersResponseVaultCluster - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go deleted file mode 100644 index 53252e43..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125LockRequest hashicorp cloud vault 20201125 lock request -// -// swagger:model hashicorp.cloud.vault_20201125.LockRequest -type HashicorpCloudVault20201125LockRequest struct { - - // cluster id - ClusterID string `json:"cluster_id,omitempty"` - - // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 lock request -func (m *HashicorpCloudVault20201125LockRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125LockRequest) validateLocation(formats strfmt.Registry) error { - if swag.IsZero(m.Location) { // not required - return nil - } - - if m.Location != nil { - if err := m.Location.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 lock request based on the context it is used -func (m *HashicorpCloudVault20201125LockRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125LockRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { - - if m.Location != nil { - if err := m.Location.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125LockRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125LockRequest) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125LockRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go deleted file mode 100644 index 3b439caf..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" -) - -// HashicorpCloudVault20201125LockResponse hashicorp cloud vault 20201125 lock response -// -// swagger:model hashicorp.cloud.vault_20201125.LockResponse -type HashicorpCloudVault20201125LockResponse struct { - - // operation - Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 lock response -func (m *HashicorpCloudVault20201125LockResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateOperation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125LockResponse) validateOperation(formats strfmt.Registry) error { - if swag.IsZero(m.Operation) { // not required - return nil - } - - if m.Operation != nil { - if err := m.Operation.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 lock response based on the context it is used -func (m *HashicorpCloudVault20201125LockResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateOperation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125LockResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { - - if m.Operation != nil { - if err := m.Operation.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125LockResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125LockResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125LockResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go deleted file mode 100644 index 797aca90..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125RaftQuorumStatus hashicorp cloud vault 20201125 raft quorum status -// -// swagger:model hashicorp.cloud.vault_20201125.RaftQuorumStatus -type HashicorpCloudVault20201125RaftQuorumStatus struct { - - // is healthy - IsHealthy bool `json:"is_healthy,omitempty"` - - // quorum number - QuorumNumber int32 `json:"quorum_number,omitempty"` - - // warning - Warning string `json:"warning,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 raft quorum status -func (m *HashicorpCloudVault20201125RaftQuorumStatus) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 raft quorum status based on context it is used -func (m *HashicorpCloudVault20201125RaftQuorumStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125RaftQuorumStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125RaftQuorumStatus) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125RaftQuorumStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go index 861c3717..b8dbdafb 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125RecreateFromSnapshotRequest hashicorp cloud vault 20201125 recreate from snapshot request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125RecreateFromSnapshotRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 recreate from snapshot request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go index 4d666411..445d25e7 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125RegisterLinkedClusterRequest hashicorp cloud vault 20201125 register linked cluster request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125RegisterLinkedClusterRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 register linked cluster request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go index 7cd035a8..d9a25bfc 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go @@ -23,9 +23,6 @@ type HashicorpCloudVault20201125RegisterLinkedClusterResponse struct { // client secret ClientSecret string `json:"client_secret,omitempty"` - // cluster id - ClusterID string `json:"cluster_id,omitempty"` - // resource id ResourceID string `json:"resource_id,omitempty"` } diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go index 009d9d63..ff0e1abd 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125RestoreSnapshotRequest hashicorp cloud vault 20201125 restore snapshot request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125RestoreSnapshotRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // snapshot id SnapshotID string `json:"snapshot_id,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go deleted file mode 100644 index 657cf7e4..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125RevokeAdminTokensRequest hashicorp cloud vault 20201125 revoke admin tokens request -// -// swagger:model hashicorp.cloud.vault_20201125.RevokeAdminTokensRequest -type HashicorpCloudVault20201125RevokeAdminTokensRequest struct { - - // cluster id - ClusterID string `json:"cluster_id,omitempty"` - - // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 revoke admin tokens request -func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) validateLocation(formats strfmt.Registry) error { - if swag.IsZero(m.Location) { // not required - return nil - } - - if m.Location != nil { - if err := m.Location.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 revoke admin tokens request based on the context it is used -func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { - - if m.Location != nil { - if err := m.Location.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125RevokeAdminTokensRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go deleted file mode 100644 index 704e9983..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go +++ /dev/null @@ -1,11 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -// HashicorpCloudVault20201125RevokeAdminTokensResponse hashicorp cloud vault 20201125 revoke admin tokens response -// -// swagger:model hashicorp.cloud.vault_20201125.RevokeAdminTokensResponse -type HashicorpCloudVault20201125RevokeAdminTokensResponse interface{} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go index f0a50de6..3d8bd404 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125SealRequest hashicorp cloud vault 20201125 seal request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125SealRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 seal request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go index 9672485e..61c1ae6f 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go @@ -12,6 +12,7 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125Snapshot Snapshot is our representation needed to back-up a Vault cluster. @@ -26,11 +27,8 @@ type HashicorpCloudVault20201125Snapshot struct { // Format: date-time FinishedAt strfmt.DateTime `json:"finished_at,omitempty"` - // if the snapshot is for a locked cluster - IsLocked bool `json:"is_locked,omitempty"` - // location is the location of the Snapshot. - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // Name of the snapshot Name string `json:"name,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go deleted file mode 100644 index 37772243..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go +++ /dev/null @@ -1,107 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125UnlockRequest hashicorp cloud vault 20201125 unlock request -// -// swagger:model hashicorp.cloud.vault_20201125.UnlockRequest -type HashicorpCloudVault20201125UnlockRequest struct { - - // cluster id - ClusterID string `json:"cluster_id,omitempty"` - - // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 unlock request -func (m *HashicorpCloudVault20201125UnlockRequest) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLocation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125UnlockRequest) validateLocation(formats strfmt.Registry) error { - if swag.IsZero(m.Location) { // not required - return nil - } - - if m.Location != nil { - if err := m.Location.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 unlock request based on the context it is used -func (m *HashicorpCloudVault20201125UnlockRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateLocation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125UnlockRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { - - if m.Location != nil { - if err := m.Location.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("location") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("location") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125UnlockRequest) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125UnlockRequest) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125UnlockRequest - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go deleted file mode 100644 index 47adf1cf..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go +++ /dev/null @@ -1,105 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" -) - -// HashicorpCloudVault20201125UnlockResponse hashicorp cloud vault 20201125 unlock response -// -// swagger:model hashicorp.cloud.vault_20201125.UnlockResponse -type HashicorpCloudVault20201125UnlockResponse struct { - - // operation - Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 unlock response -func (m *HashicorpCloudVault20201125UnlockResponse) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateOperation(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125UnlockResponse) validateOperation(formats strfmt.Registry) error { - if swag.IsZero(m.Operation) { // not required - return nil - } - - if m.Operation != nil { - if err := m.Operation.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// ContextValidate validate this hashicorp cloud vault 20201125 unlock response based on the context it is used -func (m *HashicorpCloudVault20201125UnlockResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateOperation(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125UnlockResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { - - if m.Operation != nil { - if err := m.Operation.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("operation") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("operation") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125UnlockResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125UnlockResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125UnlockResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go index 39a600be..07c94910 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UnsealRequest hashicorp cloud vault 20201125 unseal request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125UnsealRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 unseal request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go index 7895f46d..ae2609bb 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdateCORSConfigRequest hashicorp cloud vault 20201125 update c o r s config request @@ -28,7 +29,7 @@ type HashicorpCloudVault20201125UpdateCORSConfigRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 update c o r s config request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go index c22948a9..d7e37ec0 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdateMajorVersionUpgradeConfigRequest hashicorp cloud vault 20201125 update major version upgrade config request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125UpdateMajorVersionUpgradeConfigRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // maintenance window MaintenanceWindow *HashicorpCloudVault20201125MajorVersionUpgradeConfigMaintenanceWindow `json:"maintenance_window,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go index c032ef25..dbde03bd 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdatePathsFilterRequest hashicorp cloud vault 20201125 update paths filter request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125UpdatePathsFilterRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // mode Mode *HashicorpCloudVault20201125ClusterPerformanceReplicationPathsFilterMode `json:"mode,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go index 710b8f27..b29125b6 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdatePublicIpsRequest hashicorp cloud vault 20201125 update public ips request @@ -25,7 +26,7 @@ type HashicorpCloudVault20201125UpdatePublicIpsRequest struct { EnablePublicIps bool `json:"enable_public_ips,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 update public ips request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go index 06d409cf..fe874c70 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdateVersionRequest hashicorp cloud vault 20201125 update version request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125UpdateVersionRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` // version Version string `json:"version,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go index c5c27667..3105cb5a 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go @@ -11,6 +11,7 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpgradeMajorVersionRequest hashicorp cloud vault 20201125 upgrade major version request @@ -22,7 +23,7 @@ type HashicorpCloudVault20201125UpgradeMajorVersionRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 upgrade major version request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go deleted file mode 100644 index 552ed8c3..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go +++ /dev/null @@ -1,77 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// HashicorpCloudVault20201125VaultInsightsConfig hashicorp cloud vault 20201125 vault insights config -// -// swagger:model hashicorp.cloud.vault_20201125.VaultInsightsConfig -type HashicorpCloudVault20201125VaultInsightsConfig struct { - - // enabled controls the streaming of audit logs to Vault Insights - Enabled bool `json:"enabled,omitempty"` - - // last_changed indicates the last time when enabled was changed - // Format: date-time - LastChanged strfmt.DateTime `json:"last_changed,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 vault insights config -func (m *HashicorpCloudVault20201125VaultInsightsConfig) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateLastChanged(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *HashicorpCloudVault20201125VaultInsightsConfig) validateLastChanged(formats strfmt.Registry) error { - if swag.IsZero(m.LastChanged) { // not required - return nil - } - - if err := validate.FormatOf("last_changed", "body", "date-time", m.LastChanged.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 vault insights config based on context it is used -func (m *HashicorpCloudVault20201125VaultInsightsConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125VaultInsightsConfig) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125VaultInsightsConfig) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125VaultInsightsConfig - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/config/hcp.go b/config/hcp.go index 9e3f78ed..8a61913d 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -14,10 +14,6 @@ import ( "golang.org/x/oauth2/clientcredentials" ) -const ( - NoOAuth2Client = "N/A" -) - // HCPConfig provides configuration values that are useful to interact with HCP. type HCPConfig interface { @@ -99,6 +95,9 @@ type hcpConfig struct { // profile is the user's organization id and project id profile *profile.UserProfile + + // noBrowserLogin is an option to not automatically open browser login in no valid auth method is found. + noBrowserLogin bool } func (c *hcpConfig) Profile() *profile.UserProfile { diff --git a/config/new.go b/config/new.go index 2e4f1085..0d366f4b 100644 --- a/config/new.go +++ b/config/new.go @@ -5,7 +5,6 @@ package config import ( "crypto/tls" - "errors" "fmt" "net/http" "net/url" @@ -18,11 +17,6 @@ import ( "golang.org/x/oauth2/clientcredentials" ) -var ( - // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin - ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") -) - const ( // defaultAuthURL is the URL of the production auth endpoint. defaultAuthURL = "https://auth.idp.hashicorp.com" @@ -102,6 +96,13 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { } } + // fail out with a typed error if invoker specified WithoutBrowserLogin + if config.noBrowserLogin { + config.session = &auth.UserSession{ + NoBrowserLogin: true, + } + } + // Set up a token context with the custom auth TLS config tokenTransport := cleanhttp.DefaultPooledTransport() tokenTransport.TLSClientConfig = config.authTLSConfig @@ -121,7 +122,7 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Create token source from the client credentials configuration. config.tokenSource = config.clientCredentialsConfig.TokenSource(tokenContext) - } else if config.oauth2Config.ClientID != NoOAuth2Client { // Set access token via browser login or use token from existing session. + } else { // Set access token via browser login or use token from existing session. tok, err := config.session.GetToken(tokenContext, &config.oauth2Config) if err != nil { @@ -130,9 +131,6 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Update HCPConfig with most current token values. config.tokenSource = config.oauth2Config.TokenSource(tokenContext, tok) - } else { - // if the WithoutBrowserLogin option is passed in and there is no valid login already present return typed error - return nil, ErrorNoValidAuthFound } if err := config.validate(); err != nil { diff --git a/config/with.go b/config/with.go index 17485d1a..b78962a7 100644 --- a/config/with.go +++ b/config/with.go @@ -142,7 +142,7 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { // instead force the return of a typed error for users to catch func WithoutBrowserLogin() HCPConfigOption { return func(config *hcpConfig) error { - config.oauth2Config.ClientID = NoOAuth2Client + config.noBrowserLogin = true return nil } } diff --git a/config/with_test.go b/config/with_test.go index b39b1476..b9aadfdd 100644 --- a/config/with_test.go +++ b/config/with_test.go @@ -131,6 +131,6 @@ func TestWithout_BrowserLogin(t *testing.T) { config := &hcpConfig{} require.NoError(apply(config, WithoutBrowserLogin())) - // Ensure browser login is disabled - require.Equal(NoOAuth2Client, config.oauth2Config.ClientID) + // Ensure flag is set + require.True(config.noBrowserLogin) } From 877e4a3aae57163258bd8fa12326220358e1ac92 Mon Sep 17 00:00:00 2001 From: lursu Date: Mon, 17 Apr 2023 09:17:58 -0400 Subject: [PATCH 10/17] revert back --- auth/user.go | 13 +- .../delete_sentinel_policy_parameters.go | 213 ++++++++++ .../delete_sentinel_policy_responses.go | 178 ++++++++ .../deregister_linked_cluster_parameters.go | 247 +++-------- .../deregister_linked_cluster_responses.go | 16 +- .../get_available_templates_parameters.go | 241 +++++++++++ .../get_available_templates_responses.go | 178 ++++++++ .../get_linked_cluster_policy_parameters.go | 272 ------------- .../get_linked_cluster_policy_responses.go | 178 -------- .../is_vault_plugin_registered_parameters.go | 213 ++++++++++ .../is_vault_plugin_registered_responses.go | 178 ++++++++ .../list_all_clusters_parameters.go | 384 ++++++++++++++++++ .../list_all_clusters_responses.go | 178 ++++++++ .../list_snapshots_parameters.go | 43 +- .../client/vault_service/lock_parameters.go | 213 ++++++++++ .../client/vault_service/lock_responses.go | 178 ++++++++ .../revoke_admin_tokens_parameters.go | 213 ++++++++++ .../revoke_admin_tokens_responses.go | 176 ++++++++ .../client/vault_service/unlock_parameters.go | 213 ++++++++++ .../client/vault_service/unlock_responses.go | 178 ++++++++ .../vault_service/vault_service_client.go | 312 ++++++++++++-- .../hashicorp_cloud_internal_location_link.go | 129 ++++++ ...hicorp_cloud_internal_location_location.go | 111 +++++ ...ashicorp_cloud_internal_location_region.go | 53 +++ ...hashicorp_cloud_vault20201125_audit_log.go | 3 +- .../hashicorp_cloud_vault20201125_cluster.go | 3 +- ...corp_cloud_vault20201125_cluster_config.go | 46 +++ ...25_cluster_performance_replication_info.go | 3 +- ...icorp_cloud_vault20201125_cluster_state.go | 20 +- ...d_vault20201125_create_snapshot_request.go | 3 +- ...20201125_delete_sentinel_policy_request.go | 116 ++++++ ...0201125_delete_sentinel_policy_response.go | 105 +++++ ...1125_deregister_linked_cluster_response.go | 96 ++++- ...d_vault20201125_fetch_audit_log_request.go | 3 +- ...201125_get_available_templates_response.go | 116 ++++++ ...t_available_templates_response_template.go | 56 +++ ...1125_get_linked_cluster_policy_response.go | 50 --- ...icorp_cloud_vault20201125_input_cluster.go | 5 +- ...loud_vault20201125_input_cluster_config.go | 46 +++ ...ult20201125_input_vault_insights_config.go | 50 +++ ...1125_is_vault_plugin_registered_request.go | 116 ++++++ ...125_is_vault_plugin_registered_response.go | 50 +++ ...corp_cloud_vault20201125_linked_cluster.go | 144 ++++++- ...cloud_vault20201125_linked_cluster_node.go | 293 +++++++++++++ ...01125_linked_cluster_node_leader_status.go | 91 +++++ ...t20201125_linked_cluster_node_log_level.go | 90 ++++ ...vault20201125_linked_cluster_node_state.go | 87 ++++ ...1125_linked_cluster_node_version_status.go | 90 ++++ ...loud_vault20201125_linked_cluster_state.go | 5 +- ...ault20201125_list_all_clusters_response.go | 163 ++++++++ ...ist_all_clusters_response_vault_cluster.go | 150 +++++++ ...hicorp_cloud_vault20201125_lock_request.go | 107 +++++ ...icorp_cloud_vault20201125_lock_response.go | 105 +++++ ..._cloud_vault20201125_raft_quorum_status.go | 56 +++ ...20201125_recreate_from_snapshot_request.go | 3 +- ...0201125_register_linked_cluster_request.go | 3 +- ...201125_register_linked_cluster_response.go | 3 + ..._vault20201125_restore_snapshot_request.go | 3 +- ...ult20201125_revoke_admin_tokens_request.go | 107 +++++ ...lt20201125_revoke_admin_tokens_response.go | 11 + ...hicorp_cloud_vault20201125_seal_request.go | 3 +- .../hashicorp_cloud_vault20201125_snapshot.go | 6 +- ...corp_cloud_vault20201125_unlock_request.go | 107 +++++ ...orp_cloud_vault20201125_unlock_response.go | 105 +++++ ...corp_cloud_vault20201125_unseal_request.go | 3 +- ...t20201125_update_c_o_r_s_config_request.go | 3 +- ...te_major_version_upgrade_config_request.go | 3 +- ...ult20201125_update_paths_filter_request.go | 3 +- ...vault20201125_update_public_ips_request.go | 3 +- ...ud_vault20201125_update_version_request.go | 3 +- ...t20201125_upgrade_major_version_request.go | 3 +- ...oud_vault20201125_vault_insights_config.go | 77 ++++ config/hcp.go | 7 +- config/new.go | 18 +- config/with.go | 2 +- config/with_test.go | 4 +- 76 files changed, 6250 insertions(+), 806 deletions(-) create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go delete mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go create mode 100644 clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go diff --git a/auth/user.go b/auth/user.go index 1d481432..f957e896 100644 --- a/auth/user.go +++ b/auth/user.go @@ -5,7 +5,6 @@ package auth import ( "context" - "errors" "fmt" "log" "time" @@ -13,15 +12,9 @@ import ( "golang.org/x/oauth2" ) -var ( - // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin - ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") -) - // UserSession implements the auth package's Session interface type UserSession struct { - browser Browser - NoBrowserLogin bool + browser Browser } // GetToken returns an access token obtained from either an existing session or new browser login. @@ -40,10 +33,6 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth // If session expiry or the AccessTokenExpiry has passed, then reauthenticate with browser login and reassign token. if readErr != nil || cache.SessionExpiry.Before(time.Now()) || cache.AccessTokenExpiry.Before(time.Now()) { - if s.NoBrowserLogin { - return nil, ErrorNoValidAuthFound - } - // Login with browser. log.Print("No credentials found, proceeding with browser login.") diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go new file mode 100644 index 00000000..5f2c7e0d --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_parameters.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// NewDeleteSentinelPolicyParams creates a new DeleteSentinelPolicyParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewDeleteSentinelPolicyParams() *DeleteSentinelPolicyParams { + return &DeleteSentinelPolicyParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDeleteSentinelPolicyParamsWithTimeout creates a new DeleteSentinelPolicyParams object +// with the ability to set a timeout on a request. +func NewDeleteSentinelPolicyParamsWithTimeout(timeout time.Duration) *DeleteSentinelPolicyParams { + return &DeleteSentinelPolicyParams{ + timeout: timeout, + } +} + +// NewDeleteSentinelPolicyParamsWithContext creates a new DeleteSentinelPolicyParams object +// with the ability to set a context for a request. +func NewDeleteSentinelPolicyParamsWithContext(ctx context.Context) *DeleteSentinelPolicyParams { + return &DeleteSentinelPolicyParams{ + Context: ctx, + } +} + +// NewDeleteSentinelPolicyParamsWithHTTPClient creates a new DeleteSentinelPolicyParams object +// with the ability to set a custom HTTPClient for a request. +func NewDeleteSentinelPolicyParamsWithHTTPClient(client *http.Client) *DeleteSentinelPolicyParams { + return &DeleteSentinelPolicyParams{ + HTTPClient: client, + } +} + +/* +DeleteSentinelPolicyParams contains all the parameters to send to the API endpoint + + for the delete sentinel policy operation. + + Typically these are written to a http.Request. +*/ +type DeleteSentinelPolicyParams struct { + + // Body. + Body *models.HashicorpCloudVault20201125DeleteSentinelPolicyRequest + + // ClusterID. + ClusterID string + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the delete sentinel policy params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteSentinelPolicyParams) WithDefaults() *DeleteSentinelPolicyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the delete sentinel policy params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DeleteSentinelPolicyParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithTimeout(timeout time.Duration) *DeleteSentinelPolicyParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithContext(ctx context.Context) *DeleteSentinelPolicyParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithHTTPClient(client *http.Client) *DeleteSentinelPolicyParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithBody(body *models.HashicorpCloudVault20201125DeleteSentinelPolicyRequest) *DeleteSentinelPolicyParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetBody(body *models.HashicorpCloudVault20201125DeleteSentinelPolicyRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithClusterID(clusterID string) *DeleteSentinelPolicyParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithLocationOrganizationID(locationOrganizationID string) *DeleteSentinelPolicyParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) WithLocationProjectID(locationProjectID string) *DeleteSentinelPolicyParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the delete sentinel policy params +func (o *DeleteSentinelPolicyParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *DeleteSentinelPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go new file mode 100644 index 00000000..2b53a1a1 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/delete_sentinel_policy_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// DeleteSentinelPolicyReader is a Reader for the DeleteSentinelPolicy structure. +type DeleteSentinelPolicyReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DeleteSentinelPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDeleteSentinelPolicyOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewDeleteSentinelPolicyDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewDeleteSentinelPolicyOK creates a DeleteSentinelPolicyOK with default headers values +func NewDeleteSentinelPolicyOK() *DeleteSentinelPolicyOK { + return &DeleteSentinelPolicyOK{} +} + +/* +DeleteSentinelPolicyOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type DeleteSentinelPolicyOK struct { + Payload *models.HashicorpCloudVault20201125DeleteSentinelPolicyResponse +} + +// IsSuccess returns true when this delete sentinel policy o k response has a 2xx status code +func (o *DeleteSentinelPolicyOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this delete sentinel policy o k response has a 3xx status code +func (o *DeleteSentinelPolicyOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this delete sentinel policy o k response has a 4xx status code +func (o *DeleteSentinelPolicyOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this delete sentinel policy o k response has a 5xx status code +func (o *DeleteSentinelPolicyOK) IsServerError() bool { + return false +} + +// IsCode returns true when this delete sentinel policy o k response a status code equal to that given +func (o *DeleteSentinelPolicyOK) IsCode(code int) bool { + return code == 200 +} + +func (o *DeleteSentinelPolicyOK) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] deleteSentinelPolicyOK %+v", 200, o.Payload) +} + +func (o *DeleteSentinelPolicyOK) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] deleteSentinelPolicyOK %+v", 200, o.Payload) +} + +func (o *DeleteSentinelPolicyOK) GetPayload() *models.HashicorpCloudVault20201125DeleteSentinelPolicyResponse { + return o.Payload +} + +func (o *DeleteSentinelPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125DeleteSentinelPolicyResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDeleteSentinelPolicyDefault creates a DeleteSentinelPolicyDefault with default headers values +func NewDeleteSentinelPolicyDefault(code int) *DeleteSentinelPolicyDefault { + return &DeleteSentinelPolicyDefault{ + _statusCode: code, + } +} + +/* +DeleteSentinelPolicyDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type DeleteSentinelPolicyDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the delete sentinel policy default response +func (o *DeleteSentinelPolicyDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this delete sentinel policy default response has a 2xx status code +func (o *DeleteSentinelPolicyDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this delete sentinel policy default response has a 3xx status code +func (o *DeleteSentinelPolicyDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this delete sentinel policy default response has a 4xx status code +func (o *DeleteSentinelPolicyDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this delete sentinel policy default response has a 5xx status code +func (o *DeleteSentinelPolicyDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this delete sentinel policy default response a status code equal to that given +func (o *DeleteSentinelPolicyDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *DeleteSentinelPolicyDefault) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] DeleteSentinelPolicy default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteSentinelPolicyDefault) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete][%d] DeleteSentinelPolicy default %+v", o._statusCode, o.Payload) +} + +func (o *DeleteSentinelPolicyDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *DeleteSentinelPolicyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go index e666da4c..52d817ab 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_parameters.go @@ -61,57 +61,32 @@ DeregisterLinkedClusterParams contains all the parameters to send to the API end */ type DeregisterLinkedClusterParams struct { - /* ClusterLinkDescription. + // ClusterID. + ClusterID string - description is a human-friendly description for this link. This is - used primarily for informational purposes such as error messages. - */ - ClusterLinkDescription *string - - /* ClusterLinkID. - - id is the identifier for this resource. - */ - ClusterLinkID *string - - /* ClusterLinkLocationOrganizationID. + /* LocationOrganizationID. organization_id is the id of the organization. */ - ClusterLinkLocationOrganizationID string + LocationOrganizationID string - /* ClusterLinkLocationProjectID. + /* LocationProjectID. project_id is the projects id. */ - ClusterLinkLocationProjectID string + LocationProjectID string - /* ClusterLinkLocationRegionProvider. + /* LocationRegionProvider. provider is the named cloud provider ("aws", "gcp", "azure"). */ - ClusterLinkLocationRegionProvider *string + LocationRegionProvider *string - /* ClusterLinkLocationRegionRegion. + /* LocationRegionRegion. region is the cloud region ("us-west1", "us-east1"). */ - ClusterLinkLocationRegionRegion *string - - /* ClusterLinkType. - - type is the unique type of the resource. Each service publishes a - unique set of types. The type value is recommended to be formatted - in "." such as "hashicorp.hvn". This is to prevent conflicts - in the future, but any string value will work. - */ - ClusterLinkType *string - - /* ClusterLinkUUID. - - uuid is the unique UUID for this resource. - */ - ClusterLinkUUID *string + LocationRegionRegion *string timeout time.Duration Context context.Context @@ -166,92 +141,59 @@ func (o *DeregisterLinkedClusterParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } -// WithClusterLinkDescription adds the clusterLinkDescription to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkDescription(clusterLinkDescription *string) *DeregisterLinkedClusterParams { - o.SetClusterLinkDescription(clusterLinkDescription) - return o -} - -// SetClusterLinkDescription adds the clusterLinkDescription to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkDescription(clusterLinkDescription *string) { - o.ClusterLinkDescription = clusterLinkDescription -} - -// WithClusterLinkID adds the clusterLinkID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkID(clusterLinkID *string) *DeregisterLinkedClusterParams { - o.SetClusterLinkID(clusterLinkID) +// WithClusterID adds the clusterID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithClusterID(clusterID string) *DeregisterLinkedClusterParams { + o.SetClusterID(clusterID) return o } -// SetClusterLinkID adds the clusterLinkId to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkID(clusterLinkID *string) { - o.ClusterLinkID = clusterLinkID +// SetClusterID adds the clusterId to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID } -// WithClusterLinkLocationOrganizationID adds the clusterLinkLocationOrganizationID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationOrganizationID(clusterLinkLocationOrganizationID string) *DeregisterLinkedClusterParams { - o.SetClusterLinkLocationOrganizationID(clusterLinkLocationOrganizationID) +// WithLocationOrganizationID adds the locationOrganizationID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithLocationOrganizationID(locationOrganizationID string) *DeregisterLinkedClusterParams { + o.SetLocationOrganizationID(locationOrganizationID) return o } -// SetClusterLinkLocationOrganizationID adds the clusterLinkLocationOrganizationId to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationOrganizationID(clusterLinkLocationOrganizationID string) { - o.ClusterLinkLocationOrganizationID = clusterLinkLocationOrganizationID +// SetLocationOrganizationID adds the locationOrganizationId to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID } -// WithClusterLinkLocationProjectID adds the clusterLinkLocationProjectID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationProjectID(clusterLinkLocationProjectID string) *DeregisterLinkedClusterParams { - o.SetClusterLinkLocationProjectID(clusterLinkLocationProjectID) +// WithLocationProjectID adds the locationProjectID to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithLocationProjectID(locationProjectID string) *DeregisterLinkedClusterParams { + o.SetLocationProjectID(locationProjectID) return o } -// SetClusterLinkLocationProjectID adds the clusterLinkLocationProjectId to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationProjectID(clusterLinkLocationProjectID string) { - o.ClusterLinkLocationProjectID = clusterLinkLocationProjectID +// SetLocationProjectID adds the locationProjectId to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID } -// WithClusterLinkLocationRegionProvider adds the clusterLinkLocationRegionProvider to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationRegionProvider(clusterLinkLocationRegionProvider *string) *DeregisterLinkedClusterParams { - o.SetClusterLinkLocationRegionProvider(clusterLinkLocationRegionProvider) +// WithLocationRegionProvider adds the locationRegionProvider to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithLocationRegionProvider(locationRegionProvider *string) *DeregisterLinkedClusterParams { + o.SetLocationRegionProvider(locationRegionProvider) return o } -// SetClusterLinkLocationRegionProvider adds the clusterLinkLocationRegionProvider to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationRegionProvider(clusterLinkLocationRegionProvider *string) { - o.ClusterLinkLocationRegionProvider = clusterLinkLocationRegionProvider +// SetLocationRegionProvider adds the locationRegionProvider to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider } -// WithClusterLinkLocationRegionRegion adds the clusterLinkLocationRegionRegion to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkLocationRegionRegion(clusterLinkLocationRegionRegion *string) *DeregisterLinkedClusterParams { - o.SetClusterLinkLocationRegionRegion(clusterLinkLocationRegionRegion) +// WithLocationRegionRegion adds the locationRegionRegion to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) WithLocationRegionRegion(locationRegionRegion *string) *DeregisterLinkedClusterParams { + o.SetLocationRegionRegion(locationRegionRegion) return o } -// SetClusterLinkLocationRegionRegion adds the clusterLinkLocationRegionRegion to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkLocationRegionRegion(clusterLinkLocationRegionRegion *string) { - o.ClusterLinkLocationRegionRegion = clusterLinkLocationRegionRegion -} - -// WithClusterLinkType adds the clusterLinkType to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkType(clusterLinkType *string) *DeregisterLinkedClusterParams { - o.SetClusterLinkType(clusterLinkType) - return o -} - -// SetClusterLinkType adds the clusterLinkType to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkType(clusterLinkType *string) { - o.ClusterLinkType = clusterLinkType -} - -// WithClusterLinkUUID adds the clusterLinkUUID to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) WithClusterLinkUUID(clusterLinkUUID *string) *DeregisterLinkedClusterParams { - o.SetClusterLinkUUID(clusterLinkUUID) - return o -} - -// SetClusterLinkUUID adds the clusterLinkUuid to the deregister linked cluster params -func (o *DeregisterLinkedClusterParams) SetClusterLinkUUID(clusterLinkUUID *string) { - o.ClusterLinkUUID = clusterLinkUUID +// SetLocationRegionRegion adds the locationRegionRegion to the deregister linked cluster params +func (o *DeregisterLinkedClusterParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion } // WriteToRequest writes these params to a swagger request @@ -262,113 +204,50 @@ func (o *DeregisterLinkedClusterParams) WriteToRequest(r runtime.ClientRequest, } var res []error - if o.ClusterLinkDescription != nil { - - // query param cluster_link.description - var qrClusterLinkDescription string - - if o.ClusterLinkDescription != nil { - qrClusterLinkDescription = *o.ClusterLinkDescription - } - qClusterLinkDescription := qrClusterLinkDescription - if qClusterLinkDescription != "" { - - if err := r.SetQueryParam("cluster_link.description", qClusterLinkDescription); err != nil { - return err - } - } - } - - if o.ClusterLinkID != nil { - - // query param cluster_link.id - var qrClusterLinkID string - - if o.ClusterLinkID != nil { - qrClusterLinkID = *o.ClusterLinkID - } - qClusterLinkID := qrClusterLinkID - if qClusterLinkID != "" { - - if err := r.SetQueryParam("cluster_link.id", qClusterLinkID); err != nil { - return err - } - } - } - - // path param cluster_link.location.organization_id - if err := r.SetPathParam("cluster_link.location.organization_id", o.ClusterLinkLocationOrganizationID); err != nil { + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { return err } - // path param cluster_link.location.project_id - if err := r.SetPathParam("cluster_link.location.project_id", o.ClusterLinkLocationProjectID); err != nil { + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { return err } - if o.ClusterLinkLocationRegionProvider != nil { - - // query param cluster_link.location.region.provider - var qrClusterLinkLocationRegionProvider string - - if o.ClusterLinkLocationRegionProvider != nil { - qrClusterLinkLocationRegionProvider = *o.ClusterLinkLocationRegionProvider - } - qClusterLinkLocationRegionProvider := qrClusterLinkLocationRegionProvider - if qClusterLinkLocationRegionProvider != "" { - - if err := r.SetQueryParam("cluster_link.location.region.provider", qClusterLinkLocationRegionProvider); err != nil { - return err - } - } - } - - if o.ClusterLinkLocationRegionRegion != nil { - - // query param cluster_link.location.region.region - var qrClusterLinkLocationRegionRegion string - - if o.ClusterLinkLocationRegionRegion != nil { - qrClusterLinkLocationRegionRegion = *o.ClusterLinkLocationRegionRegion - } - qClusterLinkLocationRegionRegion := qrClusterLinkLocationRegionRegion - if qClusterLinkLocationRegionRegion != "" { - - if err := r.SetQueryParam("cluster_link.location.region.region", qClusterLinkLocationRegionRegion); err != nil { - return err - } - } + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err } - if o.ClusterLinkType != nil { + if o.LocationRegionProvider != nil { - // query param cluster_link.type - var qrClusterLinkType string + // query param location.region.provider + var qrLocationRegionProvider string - if o.ClusterLinkType != nil { - qrClusterLinkType = *o.ClusterLinkType + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider } - qClusterLinkType := qrClusterLinkType - if qClusterLinkType != "" { + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { - if err := r.SetQueryParam("cluster_link.type", qClusterLinkType); err != nil { + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { return err } } } - if o.ClusterLinkUUID != nil { + if o.LocationRegionRegion != nil { - // query param cluster_link.uuid - var qrClusterLinkUUID string + // query param location.region.region + var qrLocationRegionRegion string - if o.ClusterLinkUUID != nil { - qrClusterLinkUUID = *o.ClusterLinkUUID + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion } - qClusterLinkUUID := qrClusterLinkUUID - if qClusterLinkUUID != "" { + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { - if err := r.SetQueryParam("cluster_link.uuid", qClusterLinkUUID); err != nil { + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { return err } } diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go index 794628a1..0c05e66e 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/deregister_linked_cluster_responses.go @@ -53,7 +53,7 @@ DeregisterLinkedClusterOK describes a response with status code 200, with defaul A successful response. */ type DeregisterLinkedClusterOK struct { - Payload models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse + Payload *models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse } // IsSuccess returns true when this deregister linked cluster o k response has a 2xx status code @@ -82,21 +82,23 @@ func (o *DeregisterLinkedClusterOK) IsCode(code int) bool { } func (o *DeregisterLinkedClusterOK) Error() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) } func (o *DeregisterLinkedClusterOK) String() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] deregisterLinkedClusterOK %+v", 200, o.Payload) } -func (o *DeregisterLinkedClusterOK) GetPayload() models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse { +func (o *DeregisterLinkedClusterOK) GetPayload() *models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse { return o.Payload } func (o *DeregisterLinkedClusterOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + o.Payload = new(models.HashicorpCloudVault20201125DeregisterLinkedClusterResponse) + // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { return err } @@ -152,11 +154,11 @@ func (o *DeregisterLinkedClusterDefault) IsCode(code int) bool { } func (o *DeregisterLinkedClusterDefault) Error() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) } func (o *DeregisterLinkedClusterDefault) String() string { - return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) + return fmt.Sprintf("[DELETE /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}][%d] DeregisterLinkedCluster default %+v", o._statusCode, o.Payload) } func (o *DeregisterLinkedClusterDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go new file mode 100644 index 00000000..4ee1ffdd --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_parameters.go @@ -0,0 +1,241 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// NewGetAvailableTemplatesParams creates a new GetAvailableTemplatesParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewGetAvailableTemplatesParams() *GetAvailableTemplatesParams { + return &GetAvailableTemplatesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetAvailableTemplatesParamsWithTimeout creates a new GetAvailableTemplatesParams object +// with the ability to set a timeout on a request. +func NewGetAvailableTemplatesParamsWithTimeout(timeout time.Duration) *GetAvailableTemplatesParams { + return &GetAvailableTemplatesParams{ + timeout: timeout, + } +} + +// NewGetAvailableTemplatesParamsWithContext creates a new GetAvailableTemplatesParams object +// with the ability to set a context for a request. +func NewGetAvailableTemplatesParamsWithContext(ctx context.Context) *GetAvailableTemplatesParams { + return &GetAvailableTemplatesParams{ + Context: ctx, + } +} + +// NewGetAvailableTemplatesParamsWithHTTPClient creates a new GetAvailableTemplatesParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetAvailableTemplatesParamsWithHTTPClient(client *http.Client) *GetAvailableTemplatesParams { + return &GetAvailableTemplatesParams{ + HTTPClient: client, + } +} + +/* +GetAvailableTemplatesParams contains all the parameters to send to the API endpoint + + for the get available templates operation. + + Typically these are written to a http.Request. +*/ +type GetAvailableTemplatesParams struct { + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + /* LocationRegionProvider. + + provider is the named cloud provider ("aws", "gcp", "azure"). + */ + LocationRegionProvider *string + + /* LocationRegionRegion. + + region is the cloud region ("us-west1", "us-east1"). + */ + LocationRegionRegion *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get available templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAvailableTemplatesParams) WithDefaults() *GetAvailableTemplatesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get available templates params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetAvailableTemplatesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get available templates params +func (o *GetAvailableTemplatesParams) WithTimeout(timeout time.Duration) *GetAvailableTemplatesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get available templates params +func (o *GetAvailableTemplatesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get available templates params +func (o *GetAvailableTemplatesParams) WithContext(ctx context.Context) *GetAvailableTemplatesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get available templates params +func (o *GetAvailableTemplatesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get available templates params +func (o *GetAvailableTemplatesParams) WithHTTPClient(client *http.Client) *GetAvailableTemplatesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get available templates params +func (o *GetAvailableTemplatesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLocationOrganizationID adds the locationOrganizationID to the get available templates params +func (o *GetAvailableTemplatesParams) WithLocationOrganizationID(locationOrganizationID string) *GetAvailableTemplatesParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the get available templates params +func (o *GetAvailableTemplatesParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the get available templates params +func (o *GetAvailableTemplatesParams) WithLocationProjectID(locationProjectID string) *GetAvailableTemplatesParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the get available templates params +func (o *GetAvailableTemplatesParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the get available templates params +func (o *GetAvailableTemplatesParams) WithLocationRegionProvider(locationRegionProvider *string) *GetAvailableTemplatesParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the get available templates params +func (o *GetAvailableTemplatesParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the get available templates params +func (o *GetAvailableTemplatesParams) WithLocationRegionRegion(locationRegionRegion *string) *GetAvailableTemplatesParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the get available templates params +func (o *GetAvailableTemplatesParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WriteToRequest writes these params to a swagger request +func (o *GetAvailableTemplatesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go new file mode 100644 index 00000000..4ca51162 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_available_templates_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// GetAvailableTemplatesReader is a Reader for the GetAvailableTemplates structure. +type GetAvailableTemplatesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetAvailableTemplatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetAvailableTemplatesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewGetAvailableTemplatesDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewGetAvailableTemplatesOK creates a GetAvailableTemplatesOK with default headers values +func NewGetAvailableTemplatesOK() *GetAvailableTemplatesOK { + return &GetAvailableTemplatesOK{} +} + +/* +GetAvailableTemplatesOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type GetAvailableTemplatesOK struct { + Payload *models.HashicorpCloudVault20201125GetAvailableTemplatesResponse +} + +// IsSuccess returns true when this get available templates o k response has a 2xx status code +func (o *GetAvailableTemplatesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get available templates o k response has a 3xx status code +func (o *GetAvailableTemplatesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get available templates o k response has a 4xx status code +func (o *GetAvailableTemplatesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get available templates o k response has a 5xx status code +func (o *GetAvailableTemplatesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get available templates o k response a status code equal to that given +func (o *GetAvailableTemplatesOK) IsCode(code int) bool { + return code == 200 +} + +func (o *GetAvailableTemplatesOK) Error() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] getAvailableTemplatesOK %+v", 200, o.Payload) +} + +func (o *GetAvailableTemplatesOK) String() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] getAvailableTemplatesOK %+v", 200, o.Payload) +} + +func (o *GetAvailableTemplatesOK) GetPayload() *models.HashicorpCloudVault20201125GetAvailableTemplatesResponse { + return o.Payload +} + +func (o *GetAvailableTemplatesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125GetAvailableTemplatesResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetAvailableTemplatesDefault creates a GetAvailableTemplatesDefault with default headers values +func NewGetAvailableTemplatesDefault(code int) *GetAvailableTemplatesDefault { + return &GetAvailableTemplatesDefault{ + _statusCode: code, + } +} + +/* +GetAvailableTemplatesDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type GetAvailableTemplatesDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the get available templates default response +func (o *GetAvailableTemplatesDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this get available templates default response has a 2xx status code +func (o *GetAvailableTemplatesDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this get available templates default response has a 3xx status code +func (o *GetAvailableTemplatesDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this get available templates default response has a 4xx status code +func (o *GetAvailableTemplatesDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this get available templates default response has a 5xx status code +func (o *GetAvailableTemplatesDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this get available templates default response a status code equal to that given +func (o *GetAvailableTemplatesDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *GetAvailableTemplatesDefault) Error() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] GetAvailableTemplates default %+v", o._statusCode, o.Payload) +} + +func (o *GetAvailableTemplatesDefault) String() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates][%d] GetAvailableTemplates default %+v", o._statusCode, o.Payload) +} + +func (o *GetAvailableTemplatesDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *GetAvailableTemplatesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go deleted file mode 100644 index 90497e59..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_parameters.go +++ /dev/null @@ -1,272 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetLinkedClusterPolicyParams creates a new GetLinkedClusterPolicyParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetLinkedClusterPolicyParams() *GetLinkedClusterPolicyParams { - return &GetLinkedClusterPolicyParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetLinkedClusterPolicyParamsWithTimeout creates a new GetLinkedClusterPolicyParams object -// with the ability to set a timeout on a request. -func NewGetLinkedClusterPolicyParamsWithTimeout(timeout time.Duration) *GetLinkedClusterPolicyParams { - return &GetLinkedClusterPolicyParams{ - timeout: timeout, - } -} - -// NewGetLinkedClusterPolicyParamsWithContext creates a new GetLinkedClusterPolicyParams object -// with the ability to set a context for a request. -func NewGetLinkedClusterPolicyParamsWithContext(ctx context.Context) *GetLinkedClusterPolicyParams { - return &GetLinkedClusterPolicyParams{ - Context: ctx, - } -} - -// NewGetLinkedClusterPolicyParamsWithHTTPClient creates a new GetLinkedClusterPolicyParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetLinkedClusterPolicyParamsWithHTTPClient(client *http.Client) *GetLinkedClusterPolicyParams { - return &GetLinkedClusterPolicyParams{ - HTTPClient: client, - } -} - -/* -GetLinkedClusterPolicyParams contains all the parameters to send to the API endpoint - - for the get linked cluster policy operation. - - Typically these are written to a http.Request. -*/ -type GetLinkedClusterPolicyParams struct { - - // ClusterID. - ClusterID *string - - /* LocationOrganizationID. - - organization_id is the id of the organization. - */ - LocationOrganizationID string - - /* LocationProjectID. - - project_id is the projects id. - */ - LocationProjectID string - - /* LocationRegionProvider. - - provider is the named cloud provider ("aws", "gcp", "azure"). - */ - LocationRegionProvider *string - - /* LocationRegionRegion. - - region is the cloud region ("us-west1", "us-east1"). - */ - LocationRegionRegion *string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get linked cluster policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetLinkedClusterPolicyParams) WithDefaults() *GetLinkedClusterPolicyParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get linked cluster policy params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetLinkedClusterPolicyParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithTimeout(timeout time.Duration) *GetLinkedClusterPolicyParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithContext(ctx context.Context) *GetLinkedClusterPolicyParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithHTTPClient(client *http.Client) *GetLinkedClusterPolicyParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithClusterID adds the clusterID to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithClusterID(clusterID *string) *GetLinkedClusterPolicyParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetClusterID(clusterID *string) { - o.ClusterID = clusterID -} - -// WithLocationOrganizationID adds the locationOrganizationID to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithLocationOrganizationID(locationOrganizationID string) *GetLinkedClusterPolicyParams { - o.SetLocationOrganizationID(locationOrganizationID) - return o -} - -// SetLocationOrganizationID adds the locationOrganizationId to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetLocationOrganizationID(locationOrganizationID string) { - o.LocationOrganizationID = locationOrganizationID -} - -// WithLocationProjectID adds the locationProjectID to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithLocationProjectID(locationProjectID string) *GetLinkedClusterPolicyParams { - o.SetLocationProjectID(locationProjectID) - return o -} - -// SetLocationProjectID adds the locationProjectId to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetLocationProjectID(locationProjectID string) { - o.LocationProjectID = locationProjectID -} - -// WithLocationRegionProvider adds the locationRegionProvider to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithLocationRegionProvider(locationRegionProvider *string) *GetLinkedClusterPolicyParams { - o.SetLocationRegionProvider(locationRegionProvider) - return o -} - -// SetLocationRegionProvider adds the locationRegionProvider to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetLocationRegionProvider(locationRegionProvider *string) { - o.LocationRegionProvider = locationRegionProvider -} - -// WithLocationRegionRegion adds the locationRegionRegion to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) WithLocationRegionRegion(locationRegionRegion *string) *GetLinkedClusterPolicyParams { - o.SetLocationRegionRegion(locationRegionRegion) - return o -} - -// SetLocationRegionRegion adds the locationRegionRegion to the get linked cluster policy params -func (o *GetLinkedClusterPolicyParams) SetLocationRegionRegion(locationRegionRegion *string) { - o.LocationRegionRegion = locationRegionRegion -} - -// WriteToRequest writes these params to a swagger request -func (o *GetLinkedClusterPolicyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - if o.ClusterID != nil { - - // query param cluster_id - var qrClusterID string - - if o.ClusterID != nil { - qrClusterID = *o.ClusterID - } - qClusterID := qrClusterID - if qClusterID != "" { - - if err := r.SetQueryParam("cluster_id", qClusterID); err != nil { - return err - } - } - } - - // path param location.organization_id - if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { - return err - } - - // path param location.project_id - if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { - return err - } - - if o.LocationRegionProvider != nil { - - // query param location.region.provider - var qrLocationRegionProvider string - - if o.LocationRegionProvider != nil { - qrLocationRegionProvider = *o.LocationRegionProvider - } - qLocationRegionProvider := qrLocationRegionProvider - if qLocationRegionProvider != "" { - - if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { - return err - } - } - } - - if o.LocationRegionRegion != nil { - - // query param location.region.region - var qrLocationRegionRegion string - - if o.LocationRegionRegion != nil { - qrLocationRegionRegion = *o.LocationRegionRegion - } - qLocationRegionRegion := qrLocationRegionRegion - if qLocationRegionRegion != "" { - - if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go deleted file mode 100644 index d50327c3..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/get_linked_cluster_policy_responses.go +++ /dev/null @@ -1,178 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package vault_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" - "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" -) - -// GetLinkedClusterPolicyReader is a Reader for the GetLinkedClusterPolicy structure. -type GetLinkedClusterPolicyReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetLinkedClusterPolicyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetLinkedClusterPolicyOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewGetLinkedClusterPolicyDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewGetLinkedClusterPolicyOK creates a GetLinkedClusterPolicyOK with default headers values -func NewGetLinkedClusterPolicyOK() *GetLinkedClusterPolicyOK { - return &GetLinkedClusterPolicyOK{} -} - -/* -GetLinkedClusterPolicyOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type GetLinkedClusterPolicyOK struct { - Payload *models.HashicorpCloudVault20201125GetLinkedClusterPolicyResponse -} - -// IsSuccess returns true when this get linked cluster policy o k response has a 2xx status code -func (o *GetLinkedClusterPolicyOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get linked cluster policy o k response has a 3xx status code -func (o *GetLinkedClusterPolicyOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get linked cluster policy o k response has a 4xx status code -func (o *GetLinkedClusterPolicyOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get linked cluster policy o k response has a 5xx status code -func (o *GetLinkedClusterPolicyOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get linked cluster policy o k response a status code equal to that given -func (o *GetLinkedClusterPolicyOK) IsCode(code int) bool { - return code == 200 -} - -func (o *GetLinkedClusterPolicyOK) Error() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) -} - -func (o *GetLinkedClusterPolicyOK) String() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] getLinkedClusterPolicyOK %+v", 200, o.Payload) -} - -func (o *GetLinkedClusterPolicyOK) GetPayload() *models.HashicorpCloudVault20201125GetLinkedClusterPolicyResponse { - return o.Payload -} - -func (o *GetLinkedClusterPolicyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetLinkedClusterPolicyDefault creates a GetLinkedClusterPolicyDefault with default headers values -func NewGetLinkedClusterPolicyDefault(code int) *GetLinkedClusterPolicyDefault { - return &GetLinkedClusterPolicyDefault{ - _statusCode: code, - } -} - -/* -GetLinkedClusterPolicyDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type GetLinkedClusterPolicyDefault struct { - _statusCode int - - Payload *cloud.GrpcGatewayRuntimeError -} - -// Code gets the status code for the get linked cluster policy default response -func (o *GetLinkedClusterPolicyDefault) Code() int { - return o._statusCode -} - -// IsSuccess returns true when this get linked cluster policy default response has a 2xx status code -func (o *GetLinkedClusterPolicyDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this get linked cluster policy default response has a 3xx status code -func (o *GetLinkedClusterPolicyDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this get linked cluster policy default response has a 4xx status code -func (o *GetLinkedClusterPolicyDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this get linked cluster policy default response has a 5xx status code -func (o *GetLinkedClusterPolicyDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this get linked cluster policy default response a status code equal to that given -func (o *GetLinkedClusterPolicyDefault) IsCode(code int) bool { - return o._statusCode == code -} - -func (o *GetLinkedClusterPolicyDefault) Error() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) -} - -func (o *GetLinkedClusterPolicyDefault) String() string { - return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy][%d] GetLinkedClusterPolicy default %+v", o._statusCode, o.Payload) -} - -func (o *GetLinkedClusterPolicyDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { - return o.Payload -} - -func (o *GetLinkedClusterPolicyDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(cloud.GrpcGatewayRuntimeError) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go new file mode 100644 index 00000000..0569b382 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_parameters.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// NewIsVaultPluginRegisteredParams creates a new IsVaultPluginRegisteredParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewIsVaultPluginRegisteredParams() *IsVaultPluginRegisteredParams { + return &IsVaultPluginRegisteredParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewIsVaultPluginRegisteredParamsWithTimeout creates a new IsVaultPluginRegisteredParams object +// with the ability to set a timeout on a request. +func NewIsVaultPluginRegisteredParamsWithTimeout(timeout time.Duration) *IsVaultPluginRegisteredParams { + return &IsVaultPluginRegisteredParams{ + timeout: timeout, + } +} + +// NewIsVaultPluginRegisteredParamsWithContext creates a new IsVaultPluginRegisteredParams object +// with the ability to set a context for a request. +func NewIsVaultPluginRegisteredParamsWithContext(ctx context.Context) *IsVaultPluginRegisteredParams { + return &IsVaultPluginRegisteredParams{ + Context: ctx, + } +} + +// NewIsVaultPluginRegisteredParamsWithHTTPClient creates a new IsVaultPluginRegisteredParams object +// with the ability to set a custom HTTPClient for a request. +func NewIsVaultPluginRegisteredParamsWithHTTPClient(client *http.Client) *IsVaultPluginRegisteredParams { + return &IsVaultPluginRegisteredParams{ + HTTPClient: client, + } +} + +/* +IsVaultPluginRegisteredParams contains all the parameters to send to the API endpoint + + for the is vault plugin registered operation. + + Typically these are written to a http.Request. +*/ +type IsVaultPluginRegisteredParams struct { + + // Body. + Body *models.HashicorpCloudVault20201125IsVaultPluginRegisteredRequest + + // ClusterID. + ClusterID string + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the is vault plugin registered params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IsVaultPluginRegisteredParams) WithDefaults() *IsVaultPluginRegisteredParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the is vault plugin registered params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *IsVaultPluginRegisteredParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithTimeout(timeout time.Duration) *IsVaultPluginRegisteredParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithContext(ctx context.Context) *IsVaultPluginRegisteredParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithHTTPClient(client *http.Client) *IsVaultPluginRegisteredParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithBody(body *models.HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) *IsVaultPluginRegisteredParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetBody(body *models.HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithClusterID(clusterID string) *IsVaultPluginRegisteredParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithLocationOrganizationID(locationOrganizationID string) *IsVaultPluginRegisteredParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) WithLocationProjectID(locationProjectID string) *IsVaultPluginRegisteredParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the is vault plugin registered params +func (o *IsVaultPluginRegisteredParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *IsVaultPluginRegisteredParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go new file mode 100644 index 00000000..4a07c188 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/is_vault_plugin_registered_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// IsVaultPluginRegisteredReader is a Reader for the IsVaultPluginRegistered structure. +type IsVaultPluginRegisteredReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *IsVaultPluginRegisteredReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewIsVaultPluginRegisteredOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewIsVaultPluginRegisteredDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewIsVaultPluginRegisteredOK creates a IsVaultPluginRegisteredOK with default headers values +func NewIsVaultPluginRegisteredOK() *IsVaultPluginRegisteredOK { + return &IsVaultPluginRegisteredOK{} +} + +/* +IsVaultPluginRegisteredOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type IsVaultPluginRegisteredOK struct { + Payload *models.HashicorpCloudVault20201125IsVaultPluginRegisteredResponse +} + +// IsSuccess returns true when this is vault plugin registered o k response has a 2xx status code +func (o *IsVaultPluginRegisteredOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this is vault plugin registered o k response has a 3xx status code +func (o *IsVaultPluginRegisteredOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this is vault plugin registered o k response has a 4xx status code +func (o *IsVaultPluginRegisteredOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this is vault plugin registered o k response has a 5xx status code +func (o *IsVaultPluginRegisteredOK) IsServerError() bool { + return false +} + +// IsCode returns true when this is vault plugin registered o k response a status code equal to that given +func (o *IsVaultPluginRegisteredOK) IsCode(code int) bool { + return code == 200 +} + +func (o *IsVaultPluginRegisteredOK) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] isVaultPluginRegisteredOK %+v", 200, o.Payload) +} + +func (o *IsVaultPluginRegisteredOK) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] isVaultPluginRegisteredOK %+v", 200, o.Payload) +} + +func (o *IsVaultPluginRegisteredOK) GetPayload() *models.HashicorpCloudVault20201125IsVaultPluginRegisteredResponse { + return o.Payload +} + +func (o *IsVaultPluginRegisteredOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewIsVaultPluginRegisteredDefault creates a IsVaultPluginRegisteredDefault with default headers values +func NewIsVaultPluginRegisteredDefault(code int) *IsVaultPluginRegisteredDefault { + return &IsVaultPluginRegisteredDefault{ + _statusCode: code, + } +} + +/* +IsVaultPluginRegisteredDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type IsVaultPluginRegisteredDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the is vault plugin registered default response +func (o *IsVaultPluginRegisteredDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this is vault plugin registered default response has a 2xx status code +func (o *IsVaultPluginRegisteredDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this is vault plugin registered default response has a 3xx status code +func (o *IsVaultPluginRegisteredDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this is vault plugin registered default response has a 4xx status code +func (o *IsVaultPluginRegisteredDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this is vault plugin registered default response has a 5xx status code +func (o *IsVaultPluginRegisteredDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this is vault plugin registered default response a status code equal to that given +func (o *IsVaultPluginRegisteredDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *IsVaultPluginRegisteredDefault) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] IsVaultPluginRegistered default %+v", o._statusCode, o.Payload) +} + +func (o *IsVaultPluginRegisteredDefault) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered][%d] IsVaultPluginRegistered default %+v", o._statusCode, o.Payload) +} + +func (o *IsVaultPluginRegisteredDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *IsVaultPluginRegisteredDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go new file mode 100644 index 00000000..b884c5c1 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_parameters.go @@ -0,0 +1,384 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NewListAllClustersParams creates a new ListAllClustersParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewListAllClustersParams() *ListAllClustersParams { + return &ListAllClustersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListAllClustersParamsWithTimeout creates a new ListAllClustersParams object +// with the ability to set a timeout on a request. +func NewListAllClustersParamsWithTimeout(timeout time.Duration) *ListAllClustersParams { + return &ListAllClustersParams{ + timeout: timeout, + } +} + +// NewListAllClustersParamsWithContext creates a new ListAllClustersParams object +// with the ability to set a context for a request. +func NewListAllClustersParamsWithContext(ctx context.Context) *ListAllClustersParams { + return &ListAllClustersParams{ + Context: ctx, + } +} + +// NewListAllClustersParamsWithHTTPClient creates a new ListAllClustersParams object +// with the ability to set a custom HTTPClient for a request. +func NewListAllClustersParamsWithHTTPClient(client *http.Client) *ListAllClustersParams { + return &ListAllClustersParams{ + HTTPClient: client, + } +} + +/* +ListAllClustersParams contains all the parameters to send to the API endpoint + + for the list all clusters operation. + + Typically these are written to a http.Request. +*/ +type ListAllClustersParams struct { + + // FiltersPrimariesOnly. + FiltersPrimariesOnly *bool + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + /* LocationRegionProvider. + + provider is the named cloud provider ("aws", "gcp", "azure"). + */ + LocationRegionProvider *string + + /* LocationRegionRegion. + + region is the cloud region ("us-west1", "us-east1"). + */ + LocationRegionRegion *string + + /* PaginationNextPageToken. + + Specifies a page token to use to retrieve the next page. Set this to the + `next_page_token` returned by previous list requests to get the next page of + results. If set, `previous_page_token` must not be set. + */ + PaginationNextPageToken *string + + /* PaginationPageSize. + + The max number of results per page that should be returned. If the number + of available results is larger than `page_size`, a `next_page_token` is + returned which can be used to get the next page of results in subsequent + requests. A value of zero will cause `page_size` to be defaulted. + + Format: int64 + */ + PaginationPageSize *int64 + + /* PaginationPreviousPageToken. + + Specifies a page token to use to retrieve the previous page. Set this to + the `previous_page_token` returned by previous list requests to get the + previous page of results. If set, `next_page_token` must not be set. + */ + PaginationPreviousPageToken *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list all clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListAllClustersParams) WithDefaults() *ListAllClustersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list all clusters params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListAllClustersParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list all clusters params +func (o *ListAllClustersParams) WithTimeout(timeout time.Duration) *ListAllClustersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list all clusters params +func (o *ListAllClustersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list all clusters params +func (o *ListAllClustersParams) WithContext(ctx context.Context) *ListAllClustersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list all clusters params +func (o *ListAllClustersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list all clusters params +func (o *ListAllClustersParams) WithHTTPClient(client *http.Client) *ListAllClustersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list all clusters params +func (o *ListAllClustersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFiltersPrimariesOnly adds the filtersPrimariesOnly to the list all clusters params +func (o *ListAllClustersParams) WithFiltersPrimariesOnly(filtersPrimariesOnly *bool) *ListAllClustersParams { + o.SetFiltersPrimariesOnly(filtersPrimariesOnly) + return o +} + +// SetFiltersPrimariesOnly adds the filtersPrimariesOnly to the list all clusters params +func (o *ListAllClustersParams) SetFiltersPrimariesOnly(filtersPrimariesOnly *bool) { + o.FiltersPrimariesOnly = filtersPrimariesOnly +} + +// WithLocationOrganizationID adds the locationOrganizationID to the list all clusters params +func (o *ListAllClustersParams) WithLocationOrganizationID(locationOrganizationID string) *ListAllClustersParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the list all clusters params +func (o *ListAllClustersParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the list all clusters params +func (o *ListAllClustersParams) WithLocationProjectID(locationProjectID string) *ListAllClustersParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the list all clusters params +func (o *ListAllClustersParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WithLocationRegionProvider adds the locationRegionProvider to the list all clusters params +func (o *ListAllClustersParams) WithLocationRegionProvider(locationRegionProvider *string) *ListAllClustersParams { + o.SetLocationRegionProvider(locationRegionProvider) + return o +} + +// SetLocationRegionProvider adds the locationRegionProvider to the list all clusters params +func (o *ListAllClustersParams) SetLocationRegionProvider(locationRegionProvider *string) { + o.LocationRegionProvider = locationRegionProvider +} + +// WithLocationRegionRegion adds the locationRegionRegion to the list all clusters params +func (o *ListAllClustersParams) WithLocationRegionRegion(locationRegionRegion *string) *ListAllClustersParams { + o.SetLocationRegionRegion(locationRegionRegion) + return o +} + +// SetLocationRegionRegion adds the locationRegionRegion to the list all clusters params +func (o *ListAllClustersParams) SetLocationRegionRegion(locationRegionRegion *string) { + o.LocationRegionRegion = locationRegionRegion +} + +// WithPaginationNextPageToken adds the paginationNextPageToken to the list all clusters params +func (o *ListAllClustersParams) WithPaginationNextPageToken(paginationNextPageToken *string) *ListAllClustersParams { + o.SetPaginationNextPageToken(paginationNextPageToken) + return o +} + +// SetPaginationNextPageToken adds the paginationNextPageToken to the list all clusters params +func (o *ListAllClustersParams) SetPaginationNextPageToken(paginationNextPageToken *string) { + o.PaginationNextPageToken = paginationNextPageToken +} + +// WithPaginationPageSize adds the paginationPageSize to the list all clusters params +func (o *ListAllClustersParams) WithPaginationPageSize(paginationPageSize *int64) *ListAllClustersParams { + o.SetPaginationPageSize(paginationPageSize) + return o +} + +// SetPaginationPageSize adds the paginationPageSize to the list all clusters params +func (o *ListAllClustersParams) SetPaginationPageSize(paginationPageSize *int64) { + o.PaginationPageSize = paginationPageSize +} + +// WithPaginationPreviousPageToken adds the paginationPreviousPageToken to the list all clusters params +func (o *ListAllClustersParams) WithPaginationPreviousPageToken(paginationPreviousPageToken *string) *ListAllClustersParams { + o.SetPaginationPreviousPageToken(paginationPreviousPageToken) + return o +} + +// SetPaginationPreviousPageToken adds the paginationPreviousPageToken to the list all clusters params +func (o *ListAllClustersParams) SetPaginationPreviousPageToken(paginationPreviousPageToken *string) { + o.PaginationPreviousPageToken = paginationPreviousPageToken +} + +// WriteToRequest writes these params to a swagger request +func (o *ListAllClustersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.FiltersPrimariesOnly != nil { + + // query param filters.primaries_only + var qrFiltersPrimariesOnly bool + + if o.FiltersPrimariesOnly != nil { + qrFiltersPrimariesOnly = *o.FiltersPrimariesOnly + } + qFiltersPrimariesOnly := swag.FormatBool(qrFiltersPrimariesOnly) + if qFiltersPrimariesOnly != "" { + + if err := r.SetQueryParam("filters.primaries_only", qFiltersPrimariesOnly); err != nil { + return err + } + } + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if o.LocationRegionProvider != nil { + + // query param location.region.provider + var qrLocationRegionProvider string + + if o.LocationRegionProvider != nil { + qrLocationRegionProvider = *o.LocationRegionProvider + } + qLocationRegionProvider := qrLocationRegionProvider + if qLocationRegionProvider != "" { + + if err := r.SetQueryParam("location.region.provider", qLocationRegionProvider); err != nil { + return err + } + } + } + + if o.LocationRegionRegion != nil { + + // query param location.region.region + var qrLocationRegionRegion string + + if o.LocationRegionRegion != nil { + qrLocationRegionRegion = *o.LocationRegionRegion + } + qLocationRegionRegion := qrLocationRegionRegion + if qLocationRegionRegion != "" { + + if err := r.SetQueryParam("location.region.region", qLocationRegionRegion); err != nil { + return err + } + } + } + + if o.PaginationNextPageToken != nil { + + // query param pagination.next_page_token + var qrPaginationNextPageToken string + + if o.PaginationNextPageToken != nil { + qrPaginationNextPageToken = *o.PaginationNextPageToken + } + qPaginationNextPageToken := qrPaginationNextPageToken + if qPaginationNextPageToken != "" { + + if err := r.SetQueryParam("pagination.next_page_token", qPaginationNextPageToken); err != nil { + return err + } + } + } + + if o.PaginationPageSize != nil { + + // query param pagination.page_size + var qrPaginationPageSize int64 + + if o.PaginationPageSize != nil { + qrPaginationPageSize = *o.PaginationPageSize + } + qPaginationPageSize := swag.FormatInt64(qrPaginationPageSize) + if qPaginationPageSize != "" { + + if err := r.SetQueryParam("pagination.page_size", qPaginationPageSize); err != nil { + return err + } + } + } + + if o.PaginationPreviousPageToken != nil { + + // query param pagination.previous_page_token + var qrPaginationPreviousPageToken string + + if o.PaginationPreviousPageToken != nil { + qrPaginationPreviousPageToken = *o.PaginationPreviousPageToken + } + qPaginationPreviousPageToken := qrPaginationPreviousPageToken + if qPaginationPreviousPageToken != "" { + + if err := r.SetQueryParam("pagination.previous_page_token", qPaginationPreviousPageToken); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go new file mode 100644 index 00000000..7aaa1130 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_all_clusters_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// ListAllClustersReader is a Reader for the ListAllClusters structure. +type ListAllClustersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListAllClustersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListAllClustersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewListAllClustersDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewListAllClustersOK creates a ListAllClustersOK with default headers values +func NewListAllClustersOK() *ListAllClustersOK { + return &ListAllClustersOK{} +} + +/* +ListAllClustersOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type ListAllClustersOK struct { + Payload *models.HashicorpCloudVault20201125ListAllClustersResponse +} + +// IsSuccess returns true when this list all clusters o k response has a 2xx status code +func (o *ListAllClustersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list all clusters o k response has a 3xx status code +func (o *ListAllClustersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list all clusters o k response has a 4xx status code +func (o *ListAllClustersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list all clusters o k response has a 5xx status code +func (o *ListAllClustersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list all clusters o k response a status code equal to that given +func (o *ListAllClustersOK) IsCode(code int) bool { + return code == 200 +} + +func (o *ListAllClustersOK) Error() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] listAllClustersOK %+v", 200, o.Payload) +} + +func (o *ListAllClustersOK) String() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] listAllClustersOK %+v", 200, o.Payload) +} + +func (o *ListAllClustersOK) GetPayload() *models.HashicorpCloudVault20201125ListAllClustersResponse { + return o.Payload +} + +func (o *ListAllClustersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125ListAllClustersResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListAllClustersDefault creates a ListAllClustersDefault with default headers values +func NewListAllClustersDefault(code int) *ListAllClustersDefault { + return &ListAllClustersDefault{ + _statusCode: code, + } +} + +/* +ListAllClustersDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type ListAllClustersDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the list all clusters default response +func (o *ListAllClustersDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this list all clusters default response has a 2xx status code +func (o *ListAllClustersDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this list all clusters default response has a 3xx status code +func (o *ListAllClustersDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this list all clusters default response has a 4xx status code +func (o *ListAllClustersDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this list all clusters default response has a 5xx status code +func (o *ListAllClustersDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this list all clusters default response a status code equal to that given +func (o *ListAllClustersDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *ListAllClustersDefault) Error() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] ListAllClusters default %+v", o._statusCode, o.Payload) +} + +func (o *ListAllClustersDefault) String() string { + return fmt.Sprintf("[GET /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters][%d] ListAllClusters default %+v", o._statusCode, o.Payload) +} + +func (o *ListAllClustersDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *ListAllClustersDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go index 770bc4e1..4faf3472 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/list_snapshots_parameters.go @@ -98,10 +98,21 @@ type ListSnapshotsParams struct { /* ResourceID. - id is the identifier for this resource. + id is the ID of the resource. This may be a slug ID or a UUID depending on + the resource, and as such has no guarantee that it is globally unique. If a + globally unique identifier for the resource is required, refer to + internal_id. */ ResourceID *string + /* ResourceInternalID. + + internal_id is a globally unique identifier for the resource. In the case + that a resource has a user specifiable identifier, the internal_id will + differ. + */ + ResourceInternalID *string + /* ResourceLocationOrganizationID. organization_id is the id of the organization. @@ -137,7 +148,7 @@ type ListSnapshotsParams struct { /* ResourceUUID. - uuid is the unique UUID for this resource. + uuid is being deprecated in favor of the id field. */ ResourceUUID *string @@ -249,6 +260,17 @@ func (o *ListSnapshotsParams) SetResourceID(resourceID *string) { o.ResourceID = resourceID } +// WithResourceInternalID adds the resourceInternalID to the list snapshots params +func (o *ListSnapshotsParams) WithResourceInternalID(resourceInternalID *string) *ListSnapshotsParams { + o.SetResourceInternalID(resourceInternalID) + return o +} + +// SetResourceInternalID adds the resourceInternalId to the list snapshots params +func (o *ListSnapshotsParams) SetResourceInternalID(resourceInternalID *string) { + o.ResourceInternalID = resourceInternalID +} + // WithResourceLocationOrganizationID adds the resourceLocationOrganizationID to the list snapshots params func (o *ListSnapshotsParams) WithResourceLocationOrganizationID(resourceLocationOrganizationID string) *ListSnapshotsParams { o.SetResourceLocationOrganizationID(resourceLocationOrganizationID) @@ -408,6 +430,23 @@ func (o *ListSnapshotsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt } } + if o.ResourceInternalID != nil { + + // query param resource.internal_id + var qrResourceInternalID string + + if o.ResourceInternalID != nil { + qrResourceInternalID = *o.ResourceInternalID + } + qResourceInternalID := qrResourceInternalID + if qResourceInternalID != "" { + + if err := r.SetQueryParam("resource.internal_id", qResourceInternalID); err != nil { + return err + } + } + } + // path param resource.location.organization_id if err := r.SetPathParam("resource.location.organization_id", o.ResourceLocationOrganizationID); err != nil { return err diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go new file mode 100644 index 00000000..c1c5fa29 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_parameters.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// NewLockParams creates a new LockParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewLockParams() *LockParams { + return &LockParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewLockParamsWithTimeout creates a new LockParams object +// with the ability to set a timeout on a request. +func NewLockParamsWithTimeout(timeout time.Duration) *LockParams { + return &LockParams{ + timeout: timeout, + } +} + +// NewLockParamsWithContext creates a new LockParams object +// with the ability to set a context for a request. +func NewLockParamsWithContext(ctx context.Context) *LockParams { + return &LockParams{ + Context: ctx, + } +} + +// NewLockParamsWithHTTPClient creates a new LockParams object +// with the ability to set a custom HTTPClient for a request. +func NewLockParamsWithHTTPClient(client *http.Client) *LockParams { + return &LockParams{ + HTTPClient: client, + } +} + +/* +LockParams contains all the parameters to send to the API endpoint + + for the lock operation. + + Typically these are written to a http.Request. +*/ +type LockParams struct { + + // Body. + Body *models.HashicorpCloudVault20201125LockRequest + + // ClusterID. + ClusterID string + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the lock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LockParams) WithDefaults() *LockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the lock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LockParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the lock params +func (o *LockParams) WithTimeout(timeout time.Duration) *LockParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the lock params +func (o *LockParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the lock params +func (o *LockParams) WithContext(ctx context.Context) *LockParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the lock params +func (o *LockParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the lock params +func (o *LockParams) WithHTTPClient(client *http.Client) *LockParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the lock params +func (o *LockParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the lock params +func (o *LockParams) WithBody(body *models.HashicorpCloudVault20201125LockRequest) *LockParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the lock params +func (o *LockParams) SetBody(body *models.HashicorpCloudVault20201125LockRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the lock params +func (o *LockParams) WithClusterID(clusterID string) *LockParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the lock params +func (o *LockParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the lock params +func (o *LockParams) WithLocationOrganizationID(locationOrganizationID string) *LockParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the lock params +func (o *LockParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the lock params +func (o *LockParams) WithLocationProjectID(locationProjectID string) *LockParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the lock params +func (o *LockParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *LockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go new file mode 100644 index 00000000..63359d24 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/lock_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// LockReader is a Reader for the Lock structure. +type LockReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *LockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewLockOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewLockDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewLockOK creates a LockOK with default headers values +func NewLockOK() *LockOK { + return &LockOK{} +} + +/* +LockOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type LockOK struct { + Payload *models.HashicorpCloudVault20201125LockResponse +} + +// IsSuccess returns true when this lock o k response has a 2xx status code +func (o *LockOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this lock o k response has a 3xx status code +func (o *LockOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lock o k response has a 4xx status code +func (o *LockOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this lock o k response has a 5xx status code +func (o *LockOK) IsServerError() bool { + return false +} + +// IsCode returns true when this lock o k response a status code equal to that given +func (o *LockOK) IsCode(code int) bool { + return code == 200 +} + +func (o *LockOK) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] lockOK %+v", 200, o.Payload) +} + +func (o *LockOK) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] lockOK %+v", 200, o.Payload) +} + +func (o *LockOK) GetPayload() *models.HashicorpCloudVault20201125LockResponse { + return o.Payload +} + +func (o *LockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125LockResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewLockDefault creates a LockDefault with default headers values +func NewLockDefault(code int) *LockDefault { + return &LockDefault{ + _statusCode: code, + } +} + +/* +LockDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type LockDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the lock default response +func (o *LockDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this lock default response has a 2xx status code +func (o *LockDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this lock default response has a 3xx status code +func (o *LockDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this lock default response has a 4xx status code +func (o *LockDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this lock default response has a 5xx status code +func (o *LockDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this lock default response a status code equal to that given +func (o *LockDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *LockDefault) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] Lock default %+v", o._statusCode, o.Payload) +} + +func (o *LockDefault) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock][%d] Lock default %+v", o._statusCode, o.Payload) +} + +func (o *LockDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *LockDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go new file mode 100644 index 00000000..661f4a5f --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_parameters.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// NewRevokeAdminTokensParams creates a new RevokeAdminTokensParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewRevokeAdminTokensParams() *RevokeAdminTokensParams { + return &RevokeAdminTokensParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRevokeAdminTokensParamsWithTimeout creates a new RevokeAdminTokensParams object +// with the ability to set a timeout on a request. +func NewRevokeAdminTokensParamsWithTimeout(timeout time.Duration) *RevokeAdminTokensParams { + return &RevokeAdminTokensParams{ + timeout: timeout, + } +} + +// NewRevokeAdminTokensParamsWithContext creates a new RevokeAdminTokensParams object +// with the ability to set a context for a request. +func NewRevokeAdminTokensParamsWithContext(ctx context.Context) *RevokeAdminTokensParams { + return &RevokeAdminTokensParams{ + Context: ctx, + } +} + +// NewRevokeAdminTokensParamsWithHTTPClient creates a new RevokeAdminTokensParams object +// with the ability to set a custom HTTPClient for a request. +func NewRevokeAdminTokensParamsWithHTTPClient(client *http.Client) *RevokeAdminTokensParams { + return &RevokeAdminTokensParams{ + HTTPClient: client, + } +} + +/* +RevokeAdminTokensParams contains all the parameters to send to the API endpoint + + for the revoke admin tokens operation. + + Typically these are written to a http.Request. +*/ +type RevokeAdminTokensParams struct { + + // Body. + Body *models.HashicorpCloudVault20201125RevokeAdminTokensRequest + + // ClusterID. + ClusterID string + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the revoke admin tokens params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RevokeAdminTokensParams) WithDefaults() *RevokeAdminTokensParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the revoke admin tokens params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RevokeAdminTokensParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithTimeout(timeout time.Duration) *RevokeAdminTokensParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithContext(ctx context.Context) *RevokeAdminTokensParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithHTTPClient(client *http.Client) *RevokeAdminTokensParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithBody(body *models.HashicorpCloudVault20201125RevokeAdminTokensRequest) *RevokeAdminTokensParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetBody(body *models.HashicorpCloudVault20201125RevokeAdminTokensRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithClusterID(clusterID string) *RevokeAdminTokensParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithLocationOrganizationID(locationOrganizationID string) *RevokeAdminTokensParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the revoke admin tokens params +func (o *RevokeAdminTokensParams) WithLocationProjectID(locationProjectID string) *RevokeAdminTokensParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the revoke admin tokens params +func (o *RevokeAdminTokensParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *RevokeAdminTokensParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go new file mode 100644 index 00000000..7648b6dd --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/revoke_admin_tokens_responses.go @@ -0,0 +1,176 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// RevokeAdminTokensReader is a Reader for the RevokeAdminTokens structure. +type RevokeAdminTokensReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RevokeAdminTokensReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRevokeAdminTokensOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewRevokeAdminTokensDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewRevokeAdminTokensOK creates a RevokeAdminTokensOK with default headers values +func NewRevokeAdminTokensOK() *RevokeAdminTokensOK { + return &RevokeAdminTokensOK{} +} + +/* +RevokeAdminTokensOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type RevokeAdminTokensOK struct { + Payload models.HashicorpCloudVault20201125RevokeAdminTokensResponse +} + +// IsSuccess returns true when this revoke admin tokens o k response has a 2xx status code +func (o *RevokeAdminTokensOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this revoke admin tokens o k response has a 3xx status code +func (o *RevokeAdminTokensOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this revoke admin tokens o k response has a 4xx status code +func (o *RevokeAdminTokensOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this revoke admin tokens o k response has a 5xx status code +func (o *RevokeAdminTokensOK) IsServerError() bool { + return false +} + +// IsCode returns true when this revoke admin tokens o k response a status code equal to that given +func (o *RevokeAdminTokensOK) IsCode(code int) bool { + return code == 200 +} + +func (o *RevokeAdminTokensOK) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] revokeAdminTokensOK %+v", 200, o.Payload) +} + +func (o *RevokeAdminTokensOK) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] revokeAdminTokensOK %+v", 200, o.Payload) +} + +func (o *RevokeAdminTokensOK) GetPayload() models.HashicorpCloudVault20201125RevokeAdminTokensResponse { + return o.Payload +} + +func (o *RevokeAdminTokensOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRevokeAdminTokensDefault creates a RevokeAdminTokensDefault with default headers values +func NewRevokeAdminTokensDefault(code int) *RevokeAdminTokensDefault { + return &RevokeAdminTokensDefault{ + _statusCode: code, + } +} + +/* +RevokeAdminTokensDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type RevokeAdminTokensDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the revoke admin tokens default response +func (o *RevokeAdminTokensDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this revoke admin tokens default response has a 2xx status code +func (o *RevokeAdminTokensDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this revoke admin tokens default response has a 3xx status code +func (o *RevokeAdminTokensDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this revoke admin tokens default response has a 4xx status code +func (o *RevokeAdminTokensDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this revoke admin tokens default response has a 5xx status code +func (o *RevokeAdminTokensDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this revoke admin tokens default response a status code equal to that given +func (o *RevokeAdminTokensDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *RevokeAdminTokensDefault) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] RevokeAdminTokens default %+v", o._statusCode, o.Payload) +} + +func (o *RevokeAdminTokensDefault) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens][%d] RevokeAdminTokens default %+v", o._statusCode, o.Payload) +} + +func (o *RevokeAdminTokensDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *RevokeAdminTokensDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go new file mode 100644 index 00000000..a24f29ed --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_parameters.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "net/http" + "time" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + cr "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// NewUnlockParams creates a new UnlockParams object, +// with the default timeout for this client. +// +// Default values are not hydrated, since defaults are normally applied by the API server side. +// +// To enforce default values in parameter, use SetDefaults or WithDefaults. +func NewUnlockParams() *UnlockParams { + return &UnlockParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUnlockParamsWithTimeout creates a new UnlockParams object +// with the ability to set a timeout on a request. +func NewUnlockParamsWithTimeout(timeout time.Duration) *UnlockParams { + return &UnlockParams{ + timeout: timeout, + } +} + +// NewUnlockParamsWithContext creates a new UnlockParams object +// with the ability to set a context for a request. +func NewUnlockParamsWithContext(ctx context.Context) *UnlockParams { + return &UnlockParams{ + Context: ctx, + } +} + +// NewUnlockParamsWithHTTPClient creates a new UnlockParams object +// with the ability to set a custom HTTPClient for a request. +func NewUnlockParamsWithHTTPClient(client *http.Client) *UnlockParams { + return &UnlockParams{ + HTTPClient: client, + } +} + +/* +UnlockParams contains all the parameters to send to the API endpoint + + for the unlock operation. + + Typically these are written to a http.Request. +*/ +type UnlockParams struct { + + // Body. + Body *models.HashicorpCloudVault20201125UnlockRequest + + // ClusterID. + ClusterID string + + /* LocationOrganizationID. + + organization_id is the id of the organization. + */ + LocationOrganizationID string + + /* LocationProjectID. + + project_id is the projects id. + */ + LocationProjectID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the unlock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UnlockParams) WithDefaults() *UnlockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the unlock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UnlockParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the unlock params +func (o *UnlockParams) WithTimeout(timeout time.Duration) *UnlockParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the unlock params +func (o *UnlockParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the unlock params +func (o *UnlockParams) WithContext(ctx context.Context) *UnlockParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the unlock params +func (o *UnlockParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the unlock params +func (o *UnlockParams) WithHTTPClient(client *http.Client) *UnlockParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the unlock params +func (o *UnlockParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithBody adds the body to the unlock params +func (o *UnlockParams) WithBody(body *models.HashicorpCloudVault20201125UnlockRequest) *UnlockParams { + o.SetBody(body) + return o +} + +// SetBody adds the body to the unlock params +func (o *UnlockParams) SetBody(body *models.HashicorpCloudVault20201125UnlockRequest) { + o.Body = body +} + +// WithClusterID adds the clusterID to the unlock params +func (o *UnlockParams) WithClusterID(clusterID string) *UnlockParams { + o.SetClusterID(clusterID) + return o +} + +// SetClusterID adds the clusterId to the unlock params +func (o *UnlockParams) SetClusterID(clusterID string) { + o.ClusterID = clusterID +} + +// WithLocationOrganizationID adds the locationOrganizationID to the unlock params +func (o *UnlockParams) WithLocationOrganizationID(locationOrganizationID string) *UnlockParams { + o.SetLocationOrganizationID(locationOrganizationID) + return o +} + +// SetLocationOrganizationID adds the locationOrganizationId to the unlock params +func (o *UnlockParams) SetLocationOrganizationID(locationOrganizationID string) { + o.LocationOrganizationID = locationOrganizationID +} + +// WithLocationProjectID adds the locationProjectID to the unlock params +func (o *UnlockParams) WithLocationProjectID(locationProjectID string) *UnlockParams { + o.SetLocationProjectID(locationProjectID) + return o +} + +// SetLocationProjectID adds the locationProjectId to the unlock params +func (o *UnlockParams) SetLocationProjectID(locationProjectID string) { + o.LocationProjectID = locationProjectID +} + +// WriteToRequest writes these params to a swagger request +func (o *UnlockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + if o.Body != nil { + if err := r.SetBodyParam(o.Body); err != nil { + return err + } + } + + // path param cluster_id + if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { + return err + } + + // path param location.organization_id + if err := r.SetPathParam("location.organization_id", o.LocationOrganizationID); err != nil { + return err + } + + // path param location.project_id + if err := r.SetPathParam("location.project_id", o.LocationProjectID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go new file mode 100644 index 00000000..5968d508 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/unlock_responses.go @@ -0,0 +1,178 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package vault_service + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" + "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-service/stable/2020-11-25/models" +) + +// UnlockReader is a Reader for the Unlock structure. +type UnlockReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UnlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUnlockOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + result := NewUnlockDefault(response.Code()) + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + if response.Code()/100 == 2 { + return result, nil + } + return nil, result + } +} + +// NewUnlockOK creates a UnlockOK with default headers values +func NewUnlockOK() *UnlockOK { + return &UnlockOK{} +} + +/* +UnlockOK describes a response with status code 200, with default header values. + +A successful response. +*/ +type UnlockOK struct { + Payload *models.HashicorpCloudVault20201125UnlockResponse +} + +// IsSuccess returns true when this unlock o k response has a 2xx status code +func (o *UnlockOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this unlock o k response has a 3xx status code +func (o *UnlockOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this unlock o k response has a 4xx status code +func (o *UnlockOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this unlock o k response has a 5xx status code +func (o *UnlockOK) IsServerError() bool { + return false +} + +// IsCode returns true when this unlock o k response a status code equal to that given +func (o *UnlockOK) IsCode(code int) bool { + return code == 200 +} + +func (o *UnlockOK) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] unlockOK %+v", 200, o.Payload) +} + +func (o *UnlockOK) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] unlockOK %+v", 200, o.Payload) +} + +func (o *UnlockOK) GetPayload() *models.HashicorpCloudVault20201125UnlockResponse { + return o.Payload +} + +func (o *UnlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HashicorpCloudVault20201125UnlockResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUnlockDefault creates a UnlockDefault with default headers values +func NewUnlockDefault(code int) *UnlockDefault { + return &UnlockDefault{ + _statusCode: code, + } +} + +/* +UnlockDefault describes a response with status code -1, with default header values. + +An unexpected error response. +*/ +type UnlockDefault struct { + _statusCode int + + Payload *cloud.GrpcGatewayRuntimeError +} + +// Code gets the status code for the unlock default response +func (o *UnlockDefault) Code() int { + return o._statusCode +} + +// IsSuccess returns true when this unlock default response has a 2xx status code +func (o *UnlockDefault) IsSuccess() bool { + return o._statusCode/100 == 2 +} + +// IsRedirect returns true when this unlock default response has a 3xx status code +func (o *UnlockDefault) IsRedirect() bool { + return o._statusCode/100 == 3 +} + +// IsClientError returns true when this unlock default response has a 4xx status code +func (o *UnlockDefault) IsClientError() bool { + return o._statusCode/100 == 4 +} + +// IsServerError returns true when this unlock default response has a 5xx status code +func (o *UnlockDefault) IsServerError() bool { + return o._statusCode/100 == 5 +} + +// IsCode returns true when this unlock default response a status code equal to that given +func (o *UnlockDefault) IsCode(code int) bool { + return o._statusCode == code +} + +func (o *UnlockDefault) Error() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] Unlock default %+v", o._statusCode, o.Payload) +} + +func (o *UnlockDefault) String() string { + return fmt.Sprintf("[POST /vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock][%d] Unlock default %+v", o._statusCode, o.Payload) +} + +func (o *UnlockDefault) GetPayload() *cloud.GrpcGatewayRuntimeError { + return o.Payload +} + +func (o *UnlockDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(cloud.GrpcGatewayRuntimeError) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go index 67c35d1d..3c043c4f 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go +++ b/clients/cloud-vault-service/stable/2020-11-25/client/vault_service/vault_service_client.go @@ -36,6 +36,8 @@ type ClientService interface { DeletePathsFilter(params *DeletePathsFilterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeletePathsFilterOK, error) + DeleteSentinelPolicy(params *DeleteSentinelPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSentinelPolicyOK, error) + DeleteSnapshot(params *DeleteSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSnapshotOK, error) DeregisterLinkedCluster(params *DeregisterLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeregisterLinkedClusterOK, error) @@ -52,6 +54,8 @@ type ClientService interface { GetAvailableProviders(params *GetAvailableProvidersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAvailableProvidersOK, error) + GetAvailableTemplates(params *GetAvailableTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAvailableTemplatesOK, error) + GetCORSConfig(params *GetCORSConfigParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCORSConfigOK, error) GetClientCounts(params *GetClientCountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetClientCountsOK, error) @@ -60,28 +64,36 @@ type ClientService interface { GetLinkedCluster(params *GetLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterOK, error) - GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterPolicyOK, error) - GetReplicationStatus(params *GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetReplicationStatusOK, error) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSnapshotOK, error) GetUtilization(params *GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUtilizationOK, error) + IsVaultPluginRegistered(params *IsVaultPluginRegisteredParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IsVaultPluginRegisteredOK, error) + List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) + ListAllClusters(params *ListAllClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAllClustersOK, error) + ListPerformanceReplicationSecondaries(params *ListPerformanceReplicationSecondariesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListPerformanceReplicationSecondariesOK, error) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListSnapshotsOK, error) + Lock(params *LockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LockOK, error) + RecreateFromSnapshot(params *RecreateFromSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RecreateFromSnapshotOK, error) RegisterLinkedCluster(params *RegisterLinkedClusterParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RegisterLinkedClusterOK, error) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RestoreSnapshotOK, error) + RevokeAdminTokens(params *RevokeAdminTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeAdminTokensOK, error) + Seal(params *SealParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SealOK, error) + Unlock(params *UnlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlockOK, error) + Unseal(params *UnsealParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnsealOK, error) Update(params *UpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateOK, error) @@ -255,6 +267,44 @@ func (a *Client) DeletePathsFilter(params *DeletePathsFilterParams, authInfo run return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +DeleteSentinelPolicy delete sentinel policy API +*/ +func (a *Client) DeleteSentinelPolicy(params *DeleteSentinelPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeleteSentinelPolicyOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDeleteSentinelPolicyParams() + } + op := &runtime.ClientOperation{ + ID: "DeleteSentinelPolicy", + Method: "POST", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/sentinel/policy/delete", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &DeleteSentinelPolicyReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DeleteSentinelPolicyOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*DeleteSentinelPolicyDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* DeleteSnapshot delete snapshot API */ @@ -304,7 +354,7 @@ func (a *Client) DeregisterLinkedCluster(params *DeregisterLinkedClusterParams, op := &runtime.ClientOperation{ ID: "DeregisterLinkedCluster", Method: "DELETE", - PathPattern: "/vault/2020-11-25/organizations/{cluster_link.location.organization_id}/projects/{cluster_link.location.project_id}/link/deregister", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/deregister/{cluster_id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, @@ -559,6 +609,44 @@ func (a *Client) GetAvailableProviders(params *GetAvailableProvidersParams, auth return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +GetAvailableTemplates get available templates API +*/ +func (a *Client) GetAvailableTemplates(params *GetAvailableTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetAvailableTemplatesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetAvailableTemplatesParams() + } + op := &runtime.ClientOperation{ + ID: "GetAvailableTemplates", + Method: "GET", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/templates", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &GetAvailableTemplatesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetAvailableTemplatesOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*GetAvailableTemplatesDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* GetCORSConfig get c o r s config API */ @@ -712,22 +800,22 @@ func (a *Client) GetLinkedCluster(params *GetLinkedClusterParams, authInfo runti } /* -GetLinkedClusterPolicy get linked cluster policy API +GetReplicationStatus get replication status API */ -func (a *Client) GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLinkedClusterPolicyOK, error) { +func (a *Client) GetReplicationStatus(params *GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetReplicationStatusOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetLinkedClusterPolicyParams() + params = NewGetReplicationStatusParams() } op := &runtime.ClientOperation{ - ID: "GetLinkedClusterPolicy", + ID: "GetReplicationStatus", Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/link/policy", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/replication-status", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetLinkedClusterPolicyReader{formats: a.formats}, + Reader: &GetReplicationStatusReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -740,32 +828,32 @@ func (a *Client) GetLinkedClusterPolicy(params *GetLinkedClusterPolicyParams, au if err != nil { return nil, err } - success, ok := result.(*GetLinkedClusterPolicyOK) + success, ok := result.(*GetReplicationStatusOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetLinkedClusterPolicyDefault) + unexpectedSuccess := result.(*GetReplicationStatusDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -GetReplicationStatus get replication status API +GetSnapshot get snapshot API */ -func (a *Client) GetReplicationStatus(params *GetReplicationStatusParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetReplicationStatusOK, error) { +func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSnapshotOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetReplicationStatusParams() + params = NewGetSnapshotParams() } op := &runtime.ClientOperation{ - ID: "GetReplicationStatus", + ID: "GetSnapshot", Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/replication-status", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetReplicationStatusReader{formats: a.formats}, + Reader: &GetSnapshotReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -778,32 +866,32 @@ func (a *Client) GetReplicationStatus(params *GetReplicationStatusParams, authIn if err != nil { return nil, err } - success, ok := result.(*GetReplicationStatusOK) + success, ok := result.(*GetSnapshotOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetReplicationStatusDefault) + unexpectedSuccess := result.(*GetSnapshotDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -GetSnapshot get snapshot API +GetUtilization get utilization API */ -func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSnapshotOK, error) { +func (a *Client) GetUtilization(params *GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUtilizationOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetSnapshotParams() + params = NewGetUtilizationParams() } op := &runtime.ClientOperation{ - ID: "GetSnapshot", + ID: "GetUtilization", Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/snapshots/{snapshot_id}", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/utilization", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetSnapshotReader{formats: a.formats}, + Reader: &GetUtilizationReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -816,32 +904,32 @@ func (a *Client) GetSnapshot(params *GetSnapshotParams, authInfo runtime.ClientA if err != nil { return nil, err } - success, ok := result.(*GetSnapshotOK) + success, ok := result.(*GetUtilizationOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetSnapshotDefault) + unexpectedSuccess := result.(*GetUtilizationDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } /* -GetUtilization get utilization API +IsVaultPluginRegistered is vault plugin registered API */ -func (a *Client) GetUtilization(params *GetUtilizationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUtilizationOK, error) { +func (a *Client) IsVaultPluginRegistered(params *IsVaultPluginRegisteredParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*IsVaultPluginRegisteredOK, error) { // TODO: Validate the params before sending if params == nil { - params = NewGetUtilizationParams() + params = NewIsVaultPluginRegisteredParams() } op := &runtime.ClientOperation{ - ID: "GetUtilization", - Method: "GET", - PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/utilization", + ID: "IsVaultPluginRegistered", + Method: "POST", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/plugin/is-registered", ProducesMediaTypes: []string{"application/json"}, ConsumesMediaTypes: []string{"application/json"}, Schemes: []string{"http"}, Params: params, - Reader: &GetUtilizationReader{formats: a.formats}, + Reader: &IsVaultPluginRegisteredReader{formats: a.formats}, AuthInfo: authInfo, Context: params.Context, Client: params.HTTPClient, @@ -854,12 +942,12 @@ func (a *Client) GetUtilization(params *GetUtilizationParams, authInfo runtime.C if err != nil { return nil, err } - success, ok := result.(*GetUtilizationOK) + success, ok := result.(*IsVaultPluginRegisteredOK) if ok { return success, nil } // unexpected success response - unexpectedSuccess := result.(*GetUtilizationDefault) + unexpectedSuccess := result.(*IsVaultPluginRegisteredDefault) return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } @@ -901,6 +989,44 @@ func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +ListAllClusters list all clusters API +*/ +func (a *Client) ListAllClusters(params *ListAllClustersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAllClustersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListAllClustersParams() + } + op := &runtime.ClientOperation{ + ID: "ListAllClusters", + Method: "GET", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/vault-clusters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &ListAllClustersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListAllClustersOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*ListAllClustersDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* ListPerformanceReplicationSecondaries list performance replication secondaries API */ @@ -977,6 +1103,44 @@ func (a *Client) ListSnapshots(params *ListSnapshotsParams, authInfo runtime.Cli return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +Lock lock API +*/ +func (a *Client) Lock(params *LockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*LockOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewLockParams() + } + op := &runtime.ClientOperation{ + ID: "Lock", + Method: "POST", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/lock", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &LockReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*LockOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*LockDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* RecreateFromSnapshot recreate from snapshot API */ @@ -1091,6 +1255,44 @@ func (a *Client) RestoreSnapshot(params *RestoreSnapshotParams, authInfo runtime return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +RevokeAdminTokens revoke admin tokens API +*/ +func (a *Client) RevokeAdminTokens(params *RevokeAdminTokensParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RevokeAdminTokensOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRevokeAdminTokensParams() + } + op := &runtime.ClientOperation{ + ID: "RevokeAdminTokens", + Method: "POST", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/revoke-admin-tokens", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &RevokeAdminTokensReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RevokeAdminTokensOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*RevokeAdminTokensDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* Seal seal API */ @@ -1129,6 +1331,44 @@ func (a *Client) Seal(params *SealParams, authInfo runtime.ClientAuthInfoWriter, return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) } +/* +Unlock unlock API +*/ +func (a *Client) Unlock(params *UnlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UnlockOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUnlockParams() + } + op := &runtime.ClientOperation{ + ID: "Unlock", + Method: "POST", + PathPattern: "/vault/2020-11-25/organizations/{location.organization_id}/projects/{location.project_id}/clusters/{cluster_id}/unlock", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http"}, + Params: params, + Reader: &UnlockReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UnlockOK) + if ok { + return success, nil + } + // unexpected success response + unexpectedSuccess := result.(*UnlockDefault) + return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) +} + /* Unseal unseal API */ diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go new file mode 100644 index 00000000..8fbc83bb --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_link.go @@ -0,0 +1,129 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudInternalLocationLink Link is used to uniquely reference any resource within HashiCorp Cloud. +// This can be conceptually considered a "foreign key". +// +// swagger:model hashicorp.cloud.internal.location.Link +type HashicorpCloudInternalLocationLink struct { + + // description is a human-friendly description for this link. This is + // used primarily for informational purposes such as error messages. + Description string `json:"description,omitempty"` + + // id is the ID of the resource. This may be a slug ID or a UUID depending on + // the resource, and as such has no guarantee that it is globally unique. If a + // globally unique identifier for the resource is required, refer to + // internal_id. + ID string `json:"id,omitempty"` + + // internal_id is a globally unique identifier for the resource. In the case + // that a resource has a user specifiable identifier, the internal_id will + // differ. + InternalID string `json:"internal_id,omitempty"` + + // location is the location where this resource is. + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + + // type is the unique type of the resource. Each service publishes a + // unique set of types. The type value is recommended to be formatted + // in "." such as "hashicorp.hvn". This is to prevent conflicts + // in the future, but any string value will work. + Type string `json:"type,omitempty"` + + // uuid is being deprecated in favor of the id field. + UUID string `json:"uuid,omitempty"` +} + +// Validate validates this hashicorp cloud internal location link +func (m *HashicorpCloudInternalLocationLink) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudInternalLocationLink) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud internal location link based on the context it is used +func (m *HashicorpCloudInternalLocationLink) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudInternalLocationLink) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudInternalLocationLink) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudInternalLocationLink) UnmarshalBinary(b []byte) error { + var res HashicorpCloudInternalLocationLink + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go new file mode 100644 index 00000000..8c68a1bc --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_location.go @@ -0,0 +1,111 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudInternalLocationLocation Location represents a target for an operation in HCP. +// +// swagger:model hashicorp.cloud.internal.location.Location +type HashicorpCloudInternalLocationLocation struct { + + // organization_id is the id of the organization. + OrganizationID string `json:"organization_id,omitempty"` + + // project_id is the projects id. + ProjectID string `json:"project_id,omitempty"` + + // region is the region that the resource is located in. It is + // optional if the object being referenced is a global object. + Region *HashicorpCloudInternalLocationRegion `json:"region,omitempty"` +} + +// Validate validates this hashicorp cloud internal location location +func (m *HashicorpCloudInternalLocationLocation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRegion(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudInternalLocationLocation) validateRegion(formats strfmt.Registry) error { + if swag.IsZero(m.Region) { // not required + return nil + } + + if m.Region != nil { + if err := m.Region.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud internal location location based on the context it is used +func (m *HashicorpCloudInternalLocationLocation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRegion(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudInternalLocationLocation) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error { + + if m.Region != nil { + if err := m.Region.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("region") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("region") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudInternalLocationLocation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudInternalLocationLocation) UnmarshalBinary(b []byte) error { + var res HashicorpCloudInternalLocationLocation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go new file mode 100644 index 00000000..7f6a8a3e --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_internal_location_region.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudInternalLocationRegion Region identifies a Cloud data-plane region. +// +// swagger:model hashicorp.cloud.internal.location.Region +type HashicorpCloudInternalLocationRegion struct { + + // provider is the named cloud provider ("aws", "gcp", "azure") + Provider string `json:"provider,omitempty"` + + // region is the cloud region ("us-west1", "us-east1") + Region string `json:"region,omitempty"` +} + +// Validate validates this hashicorp cloud internal location region +func (m *HashicorpCloudInternalLocationRegion) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud internal location region based on context it is used +func (m *HashicorpCloudInternalLocationRegion) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudInternalLocationRegion) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudInternalLocationRegion) UnmarshalBinary(b []byte) error { + var res HashicorpCloudInternalLocationRegion + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go index 7843f910..d1ee359c 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_audit_log.go @@ -12,7 +12,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125AuditLog AuditLog represents a request for audit logs to download @@ -46,7 +45,7 @@ type HashicorpCloudVault20201125AuditLog struct { IntervalStart strfmt.DateTime `json:"interval_start,omitempty"` // location is the location of the cluster. - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // state is the current state of the download State *HashicorpCloudVault20201125AuditLogState `json:"state,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go index c88a9f05..a6e1015e 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster.go @@ -13,7 +13,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125Cluster Cluster represents a single Vault cluster. @@ -41,7 +40,7 @@ type HashicorpCloudVault20201125Cluster struct { ID string `json:"id,omitempty"` // location is the location of the cluster. - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // notifications is the list of notifications currently valid for the cluster. Notifications []*HashicorpCloudVault20201125ClusterNotification `json:"notifications"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go index 45ca7405..005aa78d 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_config.go @@ -50,6 +50,9 @@ type HashicorpCloudVault20201125ClusterConfig struct { // vault config VaultConfig *HashicorpCloudVault20201125VaultConfig `json:"vault_config,omitempty"` + + // vault insights config + VaultInsightsConfig *HashicorpCloudVault20201125VaultInsightsConfig `json:"vault_insights_config,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 cluster config @@ -96,6 +99,10 @@ func (m *HashicorpCloudVault20201125ClusterConfig) Validate(formats strfmt.Regis res = append(res, err) } + if err := m.validateVaultInsightsConfig(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -292,6 +299,25 @@ func (m *HashicorpCloudVault20201125ClusterConfig) validateVaultConfig(formats s return nil } +func (m *HashicorpCloudVault20201125ClusterConfig) validateVaultInsightsConfig(formats strfmt.Registry) error { + if swag.IsZero(m.VaultInsightsConfig) { // not required + return nil + } + + if m.VaultInsightsConfig != nil { + if err := m.VaultInsightsConfig.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vault_insights_config") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vault_insights_config") + } + return err + } + } + + return nil +} + // ContextValidate validate this hashicorp cloud vault 20201125 cluster config based on the context it is used func (m *HashicorpCloudVault20201125ClusterConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -336,6 +362,10 @@ func (m *HashicorpCloudVault20201125ClusterConfig) ContextValidate(ctx context.C res = append(res, err) } + if err := m.contextValidateVaultInsightsConfig(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -502,6 +532,22 @@ func (m *HashicorpCloudVault20201125ClusterConfig) contextValidateVaultConfig(ct return nil } +func (m *HashicorpCloudVault20201125ClusterConfig) contextValidateVaultInsightsConfig(ctx context.Context, formats strfmt.Registry) error { + + if m.VaultInsightsConfig != nil { + if err := m.VaultInsightsConfig.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vault_insights_config") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vault_insights_config") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HashicorpCloudVault20201125ClusterConfig) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go index 20ffebe4..5ca2cfbb 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_performance_replication_info.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125ClusterPerformanceReplicationInfo PerformanceReplicationInfo holds Performance Replication information @@ -29,7 +28,7 @@ type HashicorpCloudVault20201125ClusterPerformanceReplicationInfo struct { // primary_cluster_link holds the link information of the // primary cluster to which the current cluster is replicated to. This field // only applies when the cluster is a Secondary under Cluster Performance Replication. - PrimaryClusterLink *cloud.HashicorpCloudLocationLink `json:"primary_cluster_link,omitempty"` + PrimaryClusterLink *HashicorpCloudInternalLocationLink `json:"primary_cluster_link,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 cluster performance replication info diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go index 66c1ddea..97bebd84 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_cluster_state.go @@ -34,13 +34,13 @@ import ( // update. // - RESTORING: RESTORING is the state the cluster is in while restoring from a snapshot. // - DELETING: DELETING is the state the cluster is in while it is being de-provisioned. -// - DELETED: DELETED is the state the cluster is in when it has been de-provisioned. At -// -// this point, the cluster is eligible for garbage collection. // - SEALING: SEALING is the state the cluster is in when it is about to get sealed. // - SEALED: SEALED is the state the cluster is in while a cluster is sealed. // - UNSEALING: UNSEALING is the state the cluster is in when it is about to get unsealed. // - CLUSTER_SCALING: CLUSTER_SCALING is the state the cluster is in when it is under an up or down scaling operation to a new tier_size state. +// - LOCKING: LOCKING is the state the cluster is in when it is about to get locked. +// - LOCKED: LOCKED is the state the cluster is in while a cluster is locked. +// - UNLOCKING: UNLOCKING is the state the cluster is in when it is about to get unlocked. // // swagger:model hashicorp.cloud.vault_20201125.Cluster.State type HashicorpCloudVault20201125ClusterState string @@ -80,9 +80,6 @@ const ( // HashicorpCloudVault20201125ClusterStateDELETING captures enum value "DELETING" HashicorpCloudVault20201125ClusterStateDELETING HashicorpCloudVault20201125ClusterState = "DELETING" - // HashicorpCloudVault20201125ClusterStateDELETED captures enum value "DELETED" - HashicorpCloudVault20201125ClusterStateDELETED HashicorpCloudVault20201125ClusterState = "DELETED" - // HashicorpCloudVault20201125ClusterStateSEALING captures enum value "SEALING" HashicorpCloudVault20201125ClusterStateSEALING HashicorpCloudVault20201125ClusterState = "SEALING" @@ -94,6 +91,15 @@ const ( // HashicorpCloudVault20201125ClusterStateCLUSTERSCALING captures enum value "CLUSTER_SCALING" HashicorpCloudVault20201125ClusterStateCLUSTERSCALING HashicorpCloudVault20201125ClusterState = "CLUSTER_SCALING" + + // HashicorpCloudVault20201125ClusterStateLOCKING captures enum value "LOCKING" + HashicorpCloudVault20201125ClusterStateLOCKING HashicorpCloudVault20201125ClusterState = "LOCKING" + + // HashicorpCloudVault20201125ClusterStateLOCKED captures enum value "LOCKED" + HashicorpCloudVault20201125ClusterStateLOCKED HashicorpCloudVault20201125ClusterState = "LOCKED" + + // HashicorpCloudVault20201125ClusterStateUNLOCKING captures enum value "UNLOCKING" + HashicorpCloudVault20201125ClusterStateUNLOCKING HashicorpCloudVault20201125ClusterState = "UNLOCKING" ) // for schema @@ -101,7 +107,7 @@ var hashicorpCloudVault20201125ClusterStateEnum []interface{} func init() { var res []HashicorpCloudVault20201125ClusterState - if err := json.Unmarshal([]byte(`["CLUSTER_STATE_INVALID","PENDING","CREATING","RUNNING","FAILED","UPDATING","RESTORING","DELETING","DELETED","SEALING","SEALED","UNSEALING","CLUSTER_SCALING"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["CLUSTER_STATE_INVALID","PENDING","CREATING","RUNNING","FAILED","UPDATING","RESTORING","DELETING","SEALING","SEALED","UNSEALING","CLUSTER_SCALING","LOCKING","LOCKED","UNLOCKING"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go index e5c252ed..ae936a7d 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_create_snapshot_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125CreateSnapshotRequest hashicorp cloud vault 20201125 create snapshot request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125CreateSnapshotRequest struct { Name string `json:"name,omitempty"` // resource specifies the link to the resource to snapshot - Resource *cloud.HashicorpCloudLocationLink `json:"resource,omitempty"` + Resource *HashicorpCloudInternalLocationLink `json:"resource,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 create snapshot request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go new file mode 100644 index 00000000..de3571fa --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_request.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125DeleteSentinelPolicyRequest hashicorp cloud vault 20201125 delete sentinel policy request +// +// swagger:model hashicorp.cloud.vault_20201125.DeleteSentinelPolicyRequest +type HashicorpCloudVault20201125DeleteSentinelPolicyRequest struct { + + // cluster id + ClusterID string `json:"cluster_id,omitempty"` + + // egp policy + EgpPolicy []string `json:"egp_policy"` + + // location + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + + // namespace + Namespace string `json:"namespace,omitempty"` + + // rgp policy + RgpPolicy []string `json:"rgp_policy"` +} + +// Validate validates this hashicorp cloud vault 20201125 delete sentinel policy request +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 delete sentinel policy request based on the context it is used +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125DeleteSentinelPolicyRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go new file mode 100644 index 00000000..8d36f8ad --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_delete_sentinel_policy_response.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudVault20201125DeleteSentinelPolicyResponse hashicorp cloud vault 20201125 delete sentinel policy response +// +// swagger:model hashicorp.cloud.vault_20201125.DeleteSentinelPolicyResponse +type HashicorpCloudVault20201125DeleteSentinelPolicyResponse struct { + + // operation + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 delete sentinel policy response +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) validateOperation(formats strfmt.Registry) error { + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 delete sentinel policy response based on the context it is used +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125DeleteSentinelPolicyResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125DeleteSentinelPolicyResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go index d8f83a77..fd5bc472 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_deregister_linked_cluster_response.go @@ -5,7 +5,101 @@ package models // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + // HashicorpCloudVault20201125DeregisterLinkedClusterResponse hashicorp cloud vault 20201125 deregister linked cluster response // // swagger:model hashicorp.cloud.vault_20201125.DeregisterLinkedClusterResponse -type HashicorpCloudVault20201125DeregisterLinkedClusterResponse interface{} +type HashicorpCloudVault20201125DeregisterLinkedClusterResponse struct { + + // operation + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 deregister linked cluster response +func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) validateOperation(formats strfmt.Registry) error { + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 deregister linked cluster response based on the context it is used +func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125DeregisterLinkedClusterResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125DeregisterLinkedClusterResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go index 2d3682b8..0c0c8c06 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_fetch_audit_log_request.go @@ -12,7 +12,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125FetchAuditLogRequest hashicorp cloud vault 20201125 fetch audit log request @@ -32,7 +31,7 @@ type HashicorpCloudVault20201125FetchAuditLogRequest struct { IntervalStart strfmt.DateTime `json:"interval_start,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 fetch audit log request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go new file mode 100644 index 00000000..87e21fbd --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125GetAvailableTemplatesResponse hashicorp cloud vault 20201125 get available templates response +// +// swagger:model hashicorp.cloud.vault_20201125.GetAvailableTemplatesResponse +type HashicorpCloudVault20201125GetAvailableTemplatesResponse struct { + + // templates is a list of available templates. + Templates []*HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate `json:"templates"` +} + +// Validate validates this hashicorp cloud vault 20201125 get available templates response +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTemplates(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) validateTemplates(formats strfmt.Registry) error { + if swag.IsZero(m.Templates) { // not required + return nil + } + + for i := 0; i < len(m.Templates); i++ { + if swag.IsZero(m.Templates[i]) { // not required + continue + } + + if m.Templates[i] != nil { + if err := m.Templates[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("templates" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("templates" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 get available templates response based on the context it is used +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTemplates(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) contextValidateTemplates(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Templates); i++ { + + if m.Templates[i] != nil { + if err := m.Templates[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("templates" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("templates" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125GetAvailableTemplatesResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go new file mode 100644 index 00000000..d1d3f954 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_available_templates_response_template.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate hashicorp cloud vault 20201125 get available templates response template +// +// swagger:model hashicorp.cloud.vault_20201125.GetAvailableTemplatesResponse.Template +type HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate struct { + + // id + ID string `json:"id,omitempty"` + + // is beta + IsBeta bool `json:"is_beta,omitempty"` + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 get available templates response template +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 get available templates response template based on context it is used +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125GetAvailableTemplatesResponseTemplate + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go deleted file mode 100644 index 94c5d691..00000000 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_get_linked_cluster_policy_response.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// HashicorpCloudVault20201125GetLinkedClusterPolicyResponse hashicorp cloud vault 20201125 get linked cluster policy response -// -// swagger:model hashicorp.cloud.vault_20201125.GetLinkedClusterPolicyResponse -type HashicorpCloudVault20201125GetLinkedClusterPolicyResponse struct { - - // policy refers to the HCL formatted policy - Policy string `json:"policy,omitempty"` -} - -// Validate validates this hashicorp cloud vault 20201125 get linked cluster policy response -func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this hashicorp cloud vault 20201125 get linked cluster policy response based on context it is used -func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *HashicorpCloudVault20201125GetLinkedClusterPolicyResponse) UnmarshalBinary(b []byte) error { - var res HashicorpCloudVault20201125GetLinkedClusterPolicyResponse - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go index 6d196d63..6f73be1f 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125InputCluster hashicorp cloud vault 20201125 input cluster @@ -26,7 +25,7 @@ type HashicorpCloudVault20201125InputCluster struct { ID string `json:"id,omitempty"` // location is the location of the cluster. - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // performance_replication_paths_filter is the information about what paths should be // filtered for a performance replication secondary. @@ -34,7 +33,7 @@ type HashicorpCloudVault20201125InputCluster struct { // performance_replication_primary_cluster holds the link information of the // primary cluster under performance replication. - PerformanceReplicationPrimaryCluster *cloud.HashicorpCloudLocationLink `json:"performance_replication_primary_cluster,omitempty"` + PerformanceReplicationPrimaryCluster *HashicorpCloudInternalLocationLink `json:"performance_replication_primary_cluster,omitempty"` // template_input refers to the template used to create the cluster that will be applied during bootstrap time. TemplateInput *HashicorpCloudVault20201125InputClusterTemplateInput `json:"template_input,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go index 1cc0e5b2..672181e9 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_cluster_config.go @@ -32,6 +32,9 @@ type HashicorpCloudVault20201125InputClusterConfig struct { // vault_config is the Vault specific configuration VaultConfig *HashicorpCloudVault20201125VaultConfig `json:"vault_config,omitempty"` + + // vault_insights_config is the configuration for Vault Insights audit-log streaming + VaultInsightsConfig *HashicorpCloudVault20201125InputVaultInsightsConfig `json:"vault_insights_config,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 input cluster config @@ -58,6 +61,10 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) Validate(formats strfmt. res = append(res, err) } + if err := m.validateVaultInsightsConfig(formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -159,6 +166,25 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) validateVaultConfig(form return nil } +func (m *HashicorpCloudVault20201125InputClusterConfig) validateVaultInsightsConfig(formats strfmt.Registry) error { + if swag.IsZero(m.VaultInsightsConfig) { // not required + return nil + } + + if m.VaultInsightsConfig != nil { + if err := m.VaultInsightsConfig.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vault_insights_config") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vault_insights_config") + } + return err + } + } + + return nil +} + // ContextValidate validate this hashicorp cloud vault 20201125 input cluster config based on the context it is used func (m *HashicorpCloudVault20201125InputClusterConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error @@ -183,6 +209,10 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) ContextValidate(ctx cont res = append(res, err) } + if err := m.contextValidateVaultInsightsConfig(ctx, formats); err != nil { + res = append(res, err) + } + if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -269,6 +299,22 @@ func (m *HashicorpCloudVault20201125InputClusterConfig) contextValidateVaultConf return nil } +func (m *HashicorpCloudVault20201125InputClusterConfig) contextValidateVaultInsightsConfig(ctx context.Context, formats strfmt.Registry) error { + + if m.VaultInsightsConfig != nil { + if err := m.VaultInsightsConfig.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("vault_insights_config") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("vault_insights_config") + } + return err + } + } + + return nil +} + // MarshalBinary interface implementation func (m *HashicorpCloudVault20201125InputClusterConfig) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go new file mode 100644 index 00000000..98da38ad --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_input_vault_insights_config.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125InputVaultInsightsConfig hashicorp cloud vault 20201125 input vault insights config +// +// swagger:model hashicorp.cloud.vault_20201125.InputVaultInsightsConfig +type HashicorpCloudVault20201125InputVaultInsightsConfig struct { + + // enabled controls the streaming of audit logs to Vault Insights + Enabled bool `json:"enabled,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 input vault insights config +func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 input vault insights config based on context it is used +func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125InputVaultInsightsConfig) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125InputVaultInsightsConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go new file mode 100644 index 00000000..0091d5b7 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_request.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125IsVaultPluginRegisteredRequest hashicorp cloud vault 20201125 is vault plugin registered request +// +// swagger:model hashicorp.cloud.vault_20201125.IsVaultPluginRegisteredRequest +type HashicorpCloudVault20201125IsVaultPluginRegisteredRequest struct { + + // cluster id + ClusterID string `json:"cluster_id,omitempty"` + + // location + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + + // plugin name + PluginName string `json:"plugin_name,omitempty"` + + // plugin type + PluginType string `json:"plugin_type,omitempty"` + + // plugin version + PluginVersion string `json:"plugin_version,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 is vault plugin registered request +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 is vault plugin registered request based on the context it is used +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125IsVaultPluginRegisteredRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go new file mode 100644 index 00000000..dc092fc5 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_is_vault_plugin_registered_response.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125IsVaultPluginRegisteredResponse hashicorp cloud vault 20201125 is vault plugin registered response +// +// swagger:model hashicorp.cloud.vault_20201125.IsVaultPluginRegisteredResponse +type HashicorpCloudVault20201125IsVaultPluginRegisteredResponse struct { + + // is registered + IsRegistered bool `json:"is_registered,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 is vault plugin registered response +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 is vault plugin registered response based on context it is used +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125IsVaultPluginRegisteredResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125IsVaultPluginRegisteredResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go index 83877ac9..afba80a9 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster.go @@ -7,12 +7,12 @@ package models import ( "context" + "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125LinkedCluster hashicorp cloud vault 20201125 linked cluster @@ -20,30 +20,61 @@ import ( // swagger:model hashicorp.cloud.vault_20201125.LinkedCluster type HashicorpCloudVault20201125LinkedCluster struct { + // autopilot enabled + AutopilotEnabled bool `json:"autopilot_enabled,omitempty"` + + // cluster name + ClusterName string `json:"cluster_name,omitempty"` + + // created at + // Format: date-time + CreatedAt strfmt.DateTime `json:"created_at,omitempty"` + // current version CurrentVersion string `json:"current_version,omitempty"` + // ha enabled + HaEnabled bool `json:"ha_enabled,omitempty"` + // id ID string `json:"id,omitempty"` // internal id InternalID string `json:"internal_id,omitempty"` + // we don't support this since we cannot determine when a cluster is completely sealed + // due to not having access to the total number of nodes in a cluster when all connected nodes + // are sealed, including the active one. + IsSealed bool `json:"is_sealed,omitempty"` + // linked at // Format: date-time LinkedAt strfmt.DateTime `json:"linked_at,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` + + // this will be later changed/replaced by "nodes." + NodeStatuses []*HashicorpCloudVault20201125LinkedClusterNode `json:"node_statuses"` + + // raft quorum status + RaftQuorumStatus *HashicorpCloudVault20201125RaftQuorumStatus `json:"raft_quorum_status,omitempty"` // state State *HashicorpCloudVault20201125LinkedClusterState `json:"state,omitempty"` + + // storage type + StorageType string `json:"storage_type,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 linked cluster func (m *HashicorpCloudVault20201125LinkedCluster) Validate(formats strfmt.Registry) error { var res []error + if err := m.validateCreatedAt(formats); err != nil { + res = append(res, err) + } + if err := m.validateLinkedAt(formats); err != nil { res = append(res, err) } @@ -52,6 +83,14 @@ func (m *HashicorpCloudVault20201125LinkedCluster) Validate(formats strfmt.Regis res = append(res, err) } + if err := m.validateNodeStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRaftQuorumStatus(formats); err != nil { + res = append(res, err) + } + if err := m.validateState(formats); err != nil { res = append(res, err) } @@ -62,6 +101,18 @@ func (m *HashicorpCloudVault20201125LinkedCluster) Validate(formats strfmt.Regis return nil } +func (m *HashicorpCloudVault20201125LinkedCluster) validateCreatedAt(formats strfmt.Registry) error { + if swag.IsZero(m.CreatedAt) { // not required + return nil + } + + if err := validate.FormatOf("created_at", "body", "date-time", m.CreatedAt.String(), formats); err != nil { + return err + } + + return nil +} + func (m *HashicorpCloudVault20201125LinkedCluster) validateLinkedAt(formats strfmt.Registry) error { if swag.IsZero(m.LinkedAt) { // not required return nil @@ -93,6 +144,51 @@ func (m *HashicorpCloudVault20201125LinkedCluster) validateLocation(formats strf return nil } +func (m *HashicorpCloudVault20201125LinkedCluster) validateNodeStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.NodeStatuses) { // not required + return nil + } + + for i := 0; i < len(m.NodeStatuses); i++ { + if swag.IsZero(m.NodeStatuses[i]) { // not required + continue + } + + if m.NodeStatuses[i] != nil { + if err := m.NodeStatuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("node_statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("node_statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedCluster) validateRaftQuorumStatus(formats strfmt.Registry) error { + if swag.IsZero(m.RaftQuorumStatus) { // not required + return nil + } + + if m.RaftQuorumStatus != nil { + if err := m.RaftQuorumStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("raft_quorum_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("raft_quorum_status") + } + return err + } + } + + return nil +} + func (m *HashicorpCloudVault20201125LinkedCluster) validateState(formats strfmt.Registry) error { if swag.IsZero(m.State) { // not required return nil @@ -120,6 +216,14 @@ func (m *HashicorpCloudVault20201125LinkedCluster) ContextValidate(ctx context.C res = append(res, err) } + if err := m.contextValidateNodeStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRaftQuorumStatus(ctx, formats); err != nil { + res = append(res, err) + } + if err := m.contextValidateState(ctx, formats); err != nil { res = append(res, err) } @@ -146,6 +250,42 @@ func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateLocation(ctx c return nil } +func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateNodeStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.NodeStatuses); i++ { + + if m.NodeStatuses[i] != nil { + if err := m.NodeStatuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("node_statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("node_statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateRaftQuorumStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.RaftQuorumStatus != nil { + if err := m.RaftQuorumStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("raft_quorum_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("raft_quorum_status") + } + return err + } + } + + return nil +} + func (m *HashicorpCloudVault20201125LinkedCluster) contextValidateState(ctx context.Context, formats strfmt.Registry) error { if m.State != nil { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go new file mode 100644 index 00000000..d2e5c203 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node.go @@ -0,0 +1,293 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125LinkedClusterNode hashicorp cloud vault 20201125 linked cluster node +// +// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode +type HashicorpCloudVault20201125LinkedClusterNode struct { + + // alternative_versions is a list of versions that should also be considered for + // an update as they might come with additional improvements and features. + AlternativeVersions []string `json:"alternative_versions"` + + // current_version is the node's current version in semantic version format. + CurrentVersion string `json:"current_version,omitempty"` + + // has_security_flaw will be true if the current version has a security flaw. + HasSecurityFlaws bool `json:"has_security_flaws,omitempty"` + + // hostname is the hostname of the node. + Hostname string `json:"hostname,omitempty"` + + // leader_status is the leader status of the node. + LeaderStatus *HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus `json:"leader_status,omitempty"` + + // listener_addresses is a list of listener addresses for the node. + ListenerAddresses []string `json:"listener_addresses"` + + // log_level is the log level of the node. + LogLevel *HashicorpCloudVault20201125LinkedClusterNodeLogLevel `json:"log_level,omitempty"` + + // node_binary_architecture is the lower-case architecture of the client binary + // (e.g. amd64, arm, ...). + NodeBinaryArchitecture string `json:"node_binary_architecture,omitempty"` + + // node_id is the node identification. + NodeID string `json:"node_id,omitempty"` + + // node_initialized indicates if the node has been initialized. + NodeInitialized bool `json:"node_initialized,omitempty"` + + // node_os is the lower-case name of the operating system platform the client is + // running on (e.g. ubuntu). + NodeOs string `json:"node_os,omitempty"` + + // node_os_version is the lower-case name of the operating system platform version the client is + // running on (e.g. 22.04). + NodeOsVersion string `json:"node_os_version,omitempty"` + + // node_sealed indicates if the node is sealed. + NodeSealed bool `json:"node_sealed,omitempty"` + + // node_state is the HCP state of the node (linking, linked, unliking, or unlinked). + NodeState *HashicorpCloudVault20201125LinkedClusterNodeState `json:"node_state,omitempty"` + + // node_type indicates the node type. + NodeType string `json:"node_type,omitempty"` + + // recommended_version is the version the product should ideally be updated to. + RecommendedVersion string `json:"recommended_version,omitempty"` + + // status is the status of the current version. The status may help to + // determine the urgency of the update. + Status *HashicorpCloudVault20201125LinkedClusterNodeVersionStatus `json:"status,omitempty"` + + // status_version is the version of the status message format. To ensure + // that the version is not omitted by accident the initial version is 1. + StatusVersion int64 `json:"status_version,omitempty"` + + // storage_type is the storage type of the node. + StorageType string `json:"storage_type,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 linked cluster node +func (m *HashicorpCloudVault20201125LinkedClusterNode) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLeaderStatus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLogLevel(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNodeState(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) validateLeaderStatus(formats strfmt.Registry) error { + if swag.IsZero(m.LeaderStatus) { // not required + return nil + } + + if m.LeaderStatus != nil { + if err := m.LeaderStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("leader_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("leader_status") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) validateLogLevel(formats strfmt.Registry) error { + if swag.IsZero(m.LogLevel) { // not required + return nil + } + + if m.LogLevel != nil { + if err := m.LogLevel.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("log_level") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("log_level") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) validateNodeState(formats strfmt.Registry) error { + if swag.IsZero(m.NodeState) { // not required + return nil + } + + if m.NodeState != nil { + if err := m.NodeState.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("node_state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("node_state") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 linked cluster node based on the context it is used +func (m *HashicorpCloudVault20201125LinkedClusterNode) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLeaderStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLogLevel(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNodeState(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateLeaderStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.LeaderStatus != nil { + if err := m.LeaderStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("leader_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("leader_status") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateLogLevel(ctx context.Context, formats strfmt.Registry) error { + + if m.LogLevel != nil { + if err := m.LogLevel.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("log_level") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("log_level") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateNodeState(ctx context.Context, formats strfmt.Registry) error { + + if m.NodeState != nil { + if err := m.NodeState.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("node_state") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("node_state") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125LinkedClusterNode) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125LinkedClusterNode) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125LinkedClusterNode) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125LinkedClusterNode + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go new file mode 100644 index 00000000..fecf3506 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_leader_status.go @@ -0,0 +1,91 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus - LEADER: Deprecated values +// - ACTIVE: Valid values +// +// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.LeaderStatus +type HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus string + +func NewHashicorpCloudVault20201125LinkedClusterNodeLeaderStatus(value HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) *HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus { + return &value +} + +// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus. +func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus { + return &m +} + +const ( + + // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADERSTATUSCLUSTERSTATEINVALID captures enum value "LEADER_STATUS_CLUSTER_STATE_INVALID" + HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADERSTATUSCLUSTERSTATEINVALID HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "LEADER_STATUS_CLUSTER_STATE_INVALID" + + // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADER captures enum value "LEADER" + HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusLEADER HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "LEADER" + + // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusFOLLOWER captures enum value "FOLLOWER" + HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusFOLLOWER HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "FOLLOWER" + + // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusACTIVE captures enum value "ACTIVE" + HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusACTIVE HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "ACTIVE" + + // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusSTANDBY captures enum value "STANDBY" + HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusSTANDBY HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "STANDBY" + + // HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusPERFSTANDBY captures enum value "PERF_STANDBY" + HashicorpCloudVault20201125LinkedClusterNodeLeaderStatusPERFSTANDBY HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus = "PERF_STANDBY" +) + +// for schema +var hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum []interface{} + +func init() { + var res []HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus + if err := json.Unmarshal([]byte(`["LEADER_STATUS_CLUSTER_STATE_INVALID","LEADER","FOLLOWER","ACTIVE","STANDBY","PERF_STANDBY"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum = append(hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum, v) + } +} + +func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) validateHashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud vault 20201125 linked cluster node leader status +func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeLeaderStatusEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node leader status based on context it is used +func (m HashicorpCloudVault20201125LinkedClusterNodeLeaderStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go new file mode 100644 index 00000000..fd35240a --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_log_level.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudVault20201125LinkedClusterNodeLogLevel hashicorp cloud vault 20201125 linked cluster node log level +// +// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.LogLevel +type HashicorpCloudVault20201125LinkedClusterNodeLogLevel string + +func NewHashicorpCloudVault20201125LinkedClusterNodeLogLevel(value HashicorpCloudVault20201125LinkedClusterNodeLogLevel) *HashicorpCloudVault20201125LinkedClusterNodeLogLevel { + return &value +} + +// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeLogLevel. +func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeLogLevel { + return &m +} + +const ( + + // HashicorpCloudVault20201125LinkedClusterNodeLogLevelLOGLEVELCLUSTERSTATEINVALID captures enum value "LOG_LEVEL_CLUSTER_STATE_INVALID" + HashicorpCloudVault20201125LinkedClusterNodeLogLevelLOGLEVELCLUSTERSTATEINVALID HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "LOG_LEVEL_CLUSTER_STATE_INVALID" + + // HashicorpCloudVault20201125LinkedClusterNodeLogLevelTRACE captures enum value "TRACE" + HashicorpCloudVault20201125LinkedClusterNodeLogLevelTRACE HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "TRACE" + + // HashicorpCloudVault20201125LinkedClusterNodeLogLevelDEBUG captures enum value "DEBUG" + HashicorpCloudVault20201125LinkedClusterNodeLogLevelDEBUG HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "DEBUG" + + // HashicorpCloudVault20201125LinkedClusterNodeLogLevelINFO captures enum value "INFO" + HashicorpCloudVault20201125LinkedClusterNodeLogLevelINFO HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "INFO" + + // HashicorpCloudVault20201125LinkedClusterNodeLogLevelWARN captures enum value "WARN" + HashicorpCloudVault20201125LinkedClusterNodeLogLevelWARN HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "WARN" + + // HashicorpCloudVault20201125LinkedClusterNodeLogLevelERROR captures enum value "ERROR" + HashicorpCloudVault20201125LinkedClusterNodeLogLevelERROR HashicorpCloudVault20201125LinkedClusterNodeLogLevel = "ERROR" +) + +// for schema +var hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum []interface{} + +func init() { + var res []HashicorpCloudVault20201125LinkedClusterNodeLogLevel + if err := json.Unmarshal([]byte(`["LOG_LEVEL_CLUSTER_STATE_INVALID","TRACE","DEBUG","INFO","WARN","ERROR"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum = append(hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum, v) + } +} + +func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) validateHashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeLogLevel) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud vault 20201125 linked cluster node log level +func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeLogLevelEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node log level based on context it is used +func (m HashicorpCloudVault20201125LinkedClusterNodeLogLevel) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go new file mode 100644 index 00000000..dd88b65d --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_state.go @@ -0,0 +1,87 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudVault20201125LinkedClusterNodeState hashicorp cloud vault 20201125 linked cluster node state +// +// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.State +type HashicorpCloudVault20201125LinkedClusterNodeState string + +func NewHashicorpCloudVault20201125LinkedClusterNodeState(value HashicorpCloudVault20201125LinkedClusterNodeState) *HashicorpCloudVault20201125LinkedClusterNodeState { + return &value +} + +// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeState. +func (m HashicorpCloudVault20201125LinkedClusterNodeState) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeState { + return &m +} + +const ( + + // HashicorpCloudVault20201125LinkedClusterNodeStateLINKEDCLUSTERSTATEINVALID captures enum value "LINKED_CLUSTER_STATE_INVALID" + HashicorpCloudVault20201125LinkedClusterNodeStateLINKEDCLUSTERSTATEINVALID HashicorpCloudVault20201125LinkedClusterNodeState = "LINKED_CLUSTER_STATE_INVALID" + + // HashicorpCloudVault20201125LinkedClusterNodeStateLINKING captures enum value "LINKING" + HashicorpCloudVault20201125LinkedClusterNodeStateLINKING HashicorpCloudVault20201125LinkedClusterNodeState = "LINKING" + + // HashicorpCloudVault20201125LinkedClusterNodeStateLINKED captures enum value "LINKED" + HashicorpCloudVault20201125LinkedClusterNodeStateLINKED HashicorpCloudVault20201125LinkedClusterNodeState = "LINKED" + + // HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKING captures enum value "UNLINKING" + HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKING HashicorpCloudVault20201125LinkedClusterNodeState = "UNLINKING" + + // HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKED captures enum value "UNLINKED" + HashicorpCloudVault20201125LinkedClusterNodeStateUNLINKED HashicorpCloudVault20201125LinkedClusterNodeState = "UNLINKED" +) + +// for schema +var hashicorpCloudVault20201125LinkedClusterNodeStateEnum []interface{} + +func init() { + var res []HashicorpCloudVault20201125LinkedClusterNodeState + if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","UNLINKING","UNLINKED"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudVault20201125LinkedClusterNodeStateEnum = append(hashicorpCloudVault20201125LinkedClusterNodeStateEnum, v) + } +} + +func (m HashicorpCloudVault20201125LinkedClusterNodeState) validateHashicorpCloudVault20201125LinkedClusterNodeStateEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeState) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeStateEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud vault 20201125 linked cluster node state +func (m HashicorpCloudVault20201125LinkedClusterNodeState) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeStateEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node state based on context it is used +func (m HashicorpCloudVault20201125LinkedClusterNodeState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go new file mode 100644 index 00000000..d3bf585b --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_node_version_status.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/validate" +) + +// HashicorpCloudVault20201125LinkedClusterNodeVersionStatus - VERSION_UP_TO_DATE: VERSION_UP_TO_DATE is used when node is running the latest Vault Version. +// - UPGRADE_AVAILABLE: UPGRADE_AVAILABLE is used when node is running the latest minor release of a Vault Version, but there is a new major Vault version available for upgrade. +// - UPGRADE_RECOMMENDED: UPGRADE_RECOMMENDED is used when node is running an outdated but still supported version, but there is a new minor or major Vault versions available for upgrade. +// - UPGRADE_REQUIRED: UPGRADE_REQUIRED is used when node is running a no longer supported version and there are minor and major versions available for upgrade. +// +// swagger:model hashicorp.cloud.vault_20201125.LinkedClusterNode.VersionStatus +type HashicorpCloudVault20201125LinkedClusterNodeVersionStatus string + +func NewHashicorpCloudVault20201125LinkedClusterNodeVersionStatus(value HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) *HashicorpCloudVault20201125LinkedClusterNodeVersionStatus { + return &value +} + +// Pointer returns a pointer to a freshly-allocated HashicorpCloudVault20201125LinkedClusterNodeVersionStatus. +func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) Pointer() *HashicorpCloudVault20201125LinkedClusterNodeVersionStatus { + return &m +} + +const ( + + // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusLINKEDCLUSTERNODEVERSIONSTATUSINVALID captures enum value "LINKED_CLUSTER_NODE_VERSION_STATUS_INVALID" + HashicorpCloudVault20201125LinkedClusterNodeVersionStatusLINKEDCLUSTERNODEVERSIONSTATUSINVALID HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "LINKED_CLUSTER_NODE_VERSION_STATUS_INVALID" + + // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusVERSIONUPTODATE captures enum value "VERSION_UP_TO_DATE" + HashicorpCloudVault20201125LinkedClusterNodeVersionStatusVERSIONUPTODATE HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "VERSION_UP_TO_DATE" + + // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEAVAILABLE captures enum value "UPGRADE_AVAILABLE" + HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEAVAILABLE HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "UPGRADE_AVAILABLE" + + // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADERECOMMENDED captures enum value "UPGRADE_RECOMMENDED" + HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADERECOMMENDED HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "UPGRADE_RECOMMENDED" + + // HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEREQUIRED captures enum value "UPGRADE_REQUIRED" + HashicorpCloudVault20201125LinkedClusterNodeVersionStatusUPGRADEREQUIRED HashicorpCloudVault20201125LinkedClusterNodeVersionStatus = "UPGRADE_REQUIRED" +) + +// for schema +var hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum []interface{} + +func init() { + var res []HashicorpCloudVault20201125LinkedClusterNodeVersionStatus + if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_NODE_VERSION_STATUS_INVALID","VERSION_UP_TO_DATE","UPGRADE_AVAILABLE","UPGRADE_RECOMMENDED","UPGRADE_REQUIRED"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum = append(hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum, v) + } +} + +func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) validateHashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum(path, location string, value HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) error { + if err := validate.EnumCase(path, location, value, hashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum, true); err != nil { + return err + } + return nil +} + +// Validate validates this hashicorp cloud vault 20201125 linked cluster node version status +func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) Validate(formats strfmt.Registry) error { + var res []error + + // value enum + if err := m.validateHashicorpCloudVault20201125LinkedClusterNodeVersionStatusEnum("", "body", m); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 linked cluster node version status based on context it is used +func (m HashicorpCloudVault20201125LinkedClusterNodeVersionStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go index 2a2cd384..cc231024 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_linked_cluster_state.go @@ -39,9 +39,6 @@ const ( // HashicorpCloudVault20201125LinkedClusterStateLINKED captures enum value "LINKED" HashicorpCloudVault20201125LinkedClusterStateLINKED HashicorpCloudVault20201125LinkedClusterState = "LINKED" - // HashicorpCloudVault20201125LinkedClusterStateSEALED captures enum value "SEALED" - HashicorpCloudVault20201125LinkedClusterStateSEALED HashicorpCloudVault20201125LinkedClusterState = "SEALED" - // HashicorpCloudVault20201125LinkedClusterStateUNLINKING captures enum value "UNLINKING" HashicorpCloudVault20201125LinkedClusterStateUNLINKING HashicorpCloudVault20201125LinkedClusterState = "UNLINKING" @@ -54,7 +51,7 @@ var hashicorpCloudVault20201125LinkedClusterStateEnum []interface{} func init() { var res []HashicorpCloudVault20201125LinkedClusterState - if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","SEALED","UNLINKING","UNLINKED"]`), &res); err != nil { + if err := json.Unmarshal([]byte(`["LINKED_CLUSTER_STATE_INVALID","LINKING","LINKED","UNLINKING","UNLINKED"]`), &res); err != nil { panic(err) } for _, v := range res { diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go new file mode 100644 index 00000000..986dca86 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudVault20201125ListAllClustersResponse hashicorp cloud vault 20201125 list all clusters response +// +// swagger:model hashicorp.cloud.vault_20201125.ListAllClustersResponse +type HashicorpCloudVault20201125ListAllClustersResponse struct { + + // clusters + Clusters []*HashicorpCloudVault20201125ListAllClustersResponseVaultCluster `json:"clusters"` + + // pagination + Pagination *cloud.HashicorpCloudCommonPaginationResponse `json:"pagination,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 list all clusters response +func (m *HashicorpCloudVault20201125ListAllClustersResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateClusters(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePagination(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponse) validateClusters(formats strfmt.Registry) error { + if swag.IsZero(m.Clusters) { // not required + return nil + } + + for i := 0; i < len(m.Clusters); i++ { + if swag.IsZero(m.Clusters[i]) { // not required + continue + } + + if m.Clusters[i] != nil { + if err := m.Clusters[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clusters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponse) validatePagination(formats strfmt.Registry) error { + if swag.IsZero(m.Pagination) { // not required + return nil + } + + if m.Pagination != nil { + if err := m.Pagination.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pagination") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pagination") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 list all clusters response based on the context it is used +func (m *HashicorpCloudVault20201125ListAllClustersResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateClusters(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePagination(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponse) contextValidateClusters(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Clusters); i++ { + + if m.Clusters[i] != nil { + if err := m.Clusters[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("clusters" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("clusters" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponse) contextValidatePagination(ctx context.Context, formats strfmt.Registry) error { + + if m.Pagination != nil { + if err := m.Pagination.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("pagination") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("pagination") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125ListAllClustersResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125ListAllClustersResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125ListAllClustersResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go new file mode 100644 index 00000000..7356c195 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_list_all_clusters_response_vault_cluster.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125ListAllClustersResponseVaultCluster hashicorp cloud vault 20201125 list all clusters response vault cluster +// +// swagger:model hashicorp.cloud.vault_20201125.ListAllClustersResponse.VaultCluster +type HashicorpCloudVault20201125ListAllClustersResponseVaultCluster struct { + + // linked cluster + LinkedCluster *HashicorpCloudVault20201125LinkedCluster `json:"linked_cluster,omitempty"` + + // managed cluster + ManagedCluster *HashicorpCloudVault20201125Cluster `json:"managed_cluster,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 list all clusters response vault cluster +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLinkedCluster(formats); err != nil { + res = append(res, err) + } + + if err := m.validateManagedCluster(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) validateLinkedCluster(formats strfmt.Registry) error { + if swag.IsZero(m.LinkedCluster) { // not required + return nil + } + + if m.LinkedCluster != nil { + if err := m.LinkedCluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("linked_cluster") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("linked_cluster") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) validateManagedCluster(formats strfmt.Registry) error { + if swag.IsZero(m.ManagedCluster) { // not required + return nil + } + + if m.ManagedCluster != nil { + if err := m.ManagedCluster.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("managed_cluster") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("managed_cluster") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 list all clusters response vault cluster based on the context it is used +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLinkedCluster(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateManagedCluster(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) contextValidateLinkedCluster(ctx context.Context, formats strfmt.Registry) error { + + if m.LinkedCluster != nil { + if err := m.LinkedCluster.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("linked_cluster") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("linked_cluster") + } + return err + } + } + + return nil +} + +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) contextValidateManagedCluster(ctx context.Context, formats strfmt.Registry) error { + + if m.ManagedCluster != nil { + if err := m.ManagedCluster.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("managed_cluster") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("managed_cluster") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125ListAllClustersResponseVaultCluster) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125ListAllClustersResponseVaultCluster + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go new file mode 100644 index 00000000..53252e43 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_request.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125LockRequest hashicorp cloud vault 20201125 lock request +// +// swagger:model hashicorp.cloud.vault_20201125.LockRequest +type HashicorpCloudVault20201125LockRequest struct { + + // cluster id + ClusterID string `json:"cluster_id,omitempty"` + + // location + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 lock request +func (m *HashicorpCloudVault20201125LockRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125LockRequest) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 lock request based on the context it is used +func (m *HashicorpCloudVault20201125LockRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125LockRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125LockRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125LockRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125LockRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go new file mode 100644 index 00000000..3b439caf --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_lock_response.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudVault20201125LockResponse hashicorp cloud vault 20201125 lock response +// +// swagger:model hashicorp.cloud.vault_20201125.LockResponse +type HashicorpCloudVault20201125LockResponse struct { + + // operation + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 lock response +func (m *HashicorpCloudVault20201125LockResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125LockResponse) validateOperation(formats strfmt.Registry) error { + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 lock response based on the context it is used +func (m *HashicorpCloudVault20201125LockResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125LockResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125LockResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125LockResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125LockResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go new file mode 100644 index 00000000..797aca90 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_raft_quorum_status.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125RaftQuorumStatus hashicorp cloud vault 20201125 raft quorum status +// +// swagger:model hashicorp.cloud.vault_20201125.RaftQuorumStatus +type HashicorpCloudVault20201125RaftQuorumStatus struct { + + // is healthy + IsHealthy bool `json:"is_healthy,omitempty"` + + // quorum number + QuorumNumber int32 `json:"quorum_number,omitempty"` + + // warning + Warning string `json:"warning,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 raft quorum status +func (m *HashicorpCloudVault20201125RaftQuorumStatus) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 raft quorum status based on context it is used +func (m *HashicorpCloudVault20201125RaftQuorumStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125RaftQuorumStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125RaftQuorumStatus) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125RaftQuorumStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go index b8dbdafb..861c3717 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_recreate_from_snapshot_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125RecreateFromSnapshotRequest hashicorp cloud vault 20201125 recreate from snapshot request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125RecreateFromSnapshotRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 recreate from snapshot request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go index 445d25e7..4d666411 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125RegisterLinkedClusterRequest hashicorp cloud vault 20201125 register linked cluster request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125RegisterLinkedClusterRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 register linked cluster request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go index d9a25bfc..7cd035a8 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_register_linked_cluster_response.go @@ -23,6 +23,9 @@ type HashicorpCloudVault20201125RegisterLinkedClusterResponse struct { // client secret ClientSecret string `json:"client_secret,omitempty"` + // cluster id + ClusterID string `json:"cluster_id,omitempty"` + // resource id ResourceID string `json:"resource_id,omitempty"` } diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go index ff0e1abd..009d9d63 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_restore_snapshot_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125RestoreSnapshotRequest hashicorp cloud vault 20201125 restore snapshot request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125RestoreSnapshotRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // snapshot id SnapshotID string `json:"snapshot_id,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go new file mode 100644 index 00000000..657cf7e4 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_request.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125RevokeAdminTokensRequest hashicorp cloud vault 20201125 revoke admin tokens request +// +// swagger:model hashicorp.cloud.vault_20201125.RevokeAdminTokensRequest +type HashicorpCloudVault20201125RevokeAdminTokensRequest struct { + + // cluster id + ClusterID string `json:"cluster_id,omitempty"` + + // location + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 revoke admin tokens request +func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 revoke admin tokens request based on the context it is used +func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125RevokeAdminTokensRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125RevokeAdminTokensRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go new file mode 100644 index 00000000..704e9983 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_revoke_admin_tokens_response.go @@ -0,0 +1,11 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +// HashicorpCloudVault20201125RevokeAdminTokensResponse hashicorp cloud vault 20201125 revoke admin tokens response +// +// swagger:model hashicorp.cloud.vault_20201125.RevokeAdminTokensResponse +type HashicorpCloudVault20201125RevokeAdminTokensResponse interface{} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go index 3d8bd404..f0a50de6 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_seal_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125SealRequest hashicorp cloud vault 20201125 seal request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125SealRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 seal request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go index 61c1ae6f..9672485e 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_snapshot.go @@ -12,7 +12,6 @@ import ( "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125Snapshot Snapshot is our representation needed to back-up a Vault cluster. @@ -27,8 +26,11 @@ type HashicorpCloudVault20201125Snapshot struct { // Format: date-time FinishedAt strfmt.DateTime `json:"finished_at,omitempty"` + // if the snapshot is for a locked cluster + IsLocked bool `json:"is_locked,omitempty"` + // location is the location of the Snapshot. - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // Name of the snapshot Name string `json:"name,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go new file mode 100644 index 00000000..37772243 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_request.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HashicorpCloudVault20201125UnlockRequest hashicorp cloud vault 20201125 unlock request +// +// swagger:model hashicorp.cloud.vault_20201125.UnlockRequest +type HashicorpCloudVault20201125UnlockRequest struct { + + // cluster id + ClusterID string `json:"cluster_id,omitempty"` + + // location + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 unlock request +func (m *HashicorpCloudVault20201125UnlockRequest) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLocation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125UnlockRequest) validateLocation(formats strfmt.Registry) error { + if swag.IsZero(m.Location) { // not required + return nil + } + + if m.Location != nil { + if err := m.Location.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 unlock request based on the context it is used +func (m *HashicorpCloudVault20201125UnlockRequest) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLocation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125UnlockRequest) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error { + + if m.Location != nil { + if err := m.Location.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("location") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("location") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125UnlockRequest) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125UnlockRequest) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125UnlockRequest + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go new file mode 100644 index 00000000..47adf1cf --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unlock_response.go @@ -0,0 +1,105 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" +) + +// HashicorpCloudVault20201125UnlockResponse hashicorp cloud vault 20201125 unlock response +// +// swagger:model hashicorp.cloud.vault_20201125.UnlockResponse +type HashicorpCloudVault20201125UnlockResponse struct { + + // operation + Operation *cloud.HashicorpCloudOperationOperation `json:"operation,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 unlock response +func (m *HashicorpCloudVault20201125UnlockResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateOperation(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125UnlockResponse) validateOperation(formats strfmt.Registry) error { + if swag.IsZero(m.Operation) { // not required + return nil + } + + if m.Operation != nil { + if err := m.Operation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// ContextValidate validate this hashicorp cloud vault 20201125 unlock response based on the context it is used +func (m *HashicorpCloudVault20201125UnlockResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateOperation(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125UnlockResponse) contextValidateOperation(ctx context.Context, formats strfmt.Registry) error { + + if m.Operation != nil { + if err := m.Operation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("operation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("operation") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125UnlockResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125UnlockResponse) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125UnlockResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go index 07c94910..39a600be 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_unseal_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UnsealRequest hashicorp cloud vault 20201125 unseal request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125UnsealRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 unseal request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go index ae2609bb..7895f46d 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_c_o_r_s_config_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdateCORSConfigRequest hashicorp cloud vault 20201125 update c o r s config request @@ -29,7 +28,7 @@ type HashicorpCloudVault20201125UpdateCORSConfigRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 update c o r s config request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go index d7e37ec0..c22948a9 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_major_version_upgrade_config_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdateMajorVersionUpgradeConfigRequest hashicorp cloud vault 20201125 update major version upgrade config request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125UpdateMajorVersionUpgradeConfigRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // maintenance window MaintenanceWindow *HashicorpCloudVault20201125MajorVersionUpgradeConfigMaintenanceWindow `json:"maintenance_window,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go index dbde03bd..c032ef25 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_paths_filter_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdatePathsFilterRequest hashicorp cloud vault 20201125 update paths filter request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125UpdatePathsFilterRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // mode Mode *HashicorpCloudVault20201125ClusterPerformanceReplicationPathsFilterMode `json:"mode,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go index b29125b6..710b8f27 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_public_ips_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdatePublicIpsRequest hashicorp cloud vault 20201125 update public ips request @@ -26,7 +25,7 @@ type HashicorpCloudVault20201125UpdatePublicIpsRequest struct { EnablePublicIps bool `json:"enable_public_ips,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 update public ips request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go index fe874c70..06d409cf 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_update_version_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpdateVersionRequest hashicorp cloud vault 20201125 update version request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125UpdateVersionRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` // version Version string `json:"version,omitempty"` diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go index 3105cb5a..c5c27667 100644 --- a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_upgrade_major_version_request.go @@ -11,7 +11,6 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - cloud "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models" ) // HashicorpCloudVault20201125UpgradeMajorVersionRequest hashicorp cloud vault 20201125 upgrade major version request @@ -23,7 +22,7 @@ type HashicorpCloudVault20201125UpgradeMajorVersionRequest struct { ClusterID string `json:"cluster_id,omitempty"` // location - Location *cloud.HashicorpCloudLocationLocation `json:"location,omitempty"` + Location *HashicorpCloudInternalLocationLocation `json:"location,omitempty"` } // Validate validates this hashicorp cloud vault 20201125 upgrade major version request diff --git a/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go new file mode 100644 index 00000000..552ed8c3 --- /dev/null +++ b/clients/cloud-vault-service/stable/2020-11-25/models/hashicorp_cloud_vault20201125_vault_insights_config.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// HashicorpCloudVault20201125VaultInsightsConfig hashicorp cloud vault 20201125 vault insights config +// +// swagger:model hashicorp.cloud.vault_20201125.VaultInsightsConfig +type HashicorpCloudVault20201125VaultInsightsConfig struct { + + // enabled controls the streaming of audit logs to Vault Insights + Enabled bool `json:"enabled,omitempty"` + + // last_changed indicates the last time when enabled was changed + // Format: date-time + LastChanged strfmt.DateTime `json:"last_changed,omitempty"` +} + +// Validate validates this hashicorp cloud vault 20201125 vault insights config +func (m *HashicorpCloudVault20201125VaultInsightsConfig) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLastChanged(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HashicorpCloudVault20201125VaultInsightsConfig) validateLastChanged(formats strfmt.Registry) error { + if swag.IsZero(m.LastChanged) { // not required + return nil + } + + if err := validate.FormatOf("last_changed", "body", "date-time", m.LastChanged.String(), formats); err != nil { + return err + } + + return nil +} + +// ContextValidate validates this hashicorp cloud vault 20201125 vault insights config based on context it is used +func (m *HashicorpCloudVault20201125VaultInsightsConfig) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *HashicorpCloudVault20201125VaultInsightsConfig) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HashicorpCloudVault20201125VaultInsightsConfig) UnmarshalBinary(b []byte) error { + var res HashicorpCloudVault20201125VaultInsightsConfig + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/config/hcp.go b/config/hcp.go index 8a61913d..9e3f78ed 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -14,6 +14,10 @@ import ( "golang.org/x/oauth2/clientcredentials" ) +const ( + NoOAuth2Client = "N/A" +) + // HCPConfig provides configuration values that are useful to interact with HCP. type HCPConfig interface { @@ -95,9 +99,6 @@ type hcpConfig struct { // profile is the user's organization id and project id profile *profile.UserProfile - - // noBrowserLogin is an option to not automatically open browser login in no valid auth method is found. - noBrowserLogin bool } func (c *hcpConfig) Profile() *profile.UserProfile { diff --git a/config/new.go b/config/new.go index 0d366f4b..2e4f1085 100644 --- a/config/new.go +++ b/config/new.go @@ -5,6 +5,7 @@ package config import ( "crypto/tls" + "errors" "fmt" "net/http" "net/url" @@ -17,6 +18,11 @@ import ( "golang.org/x/oauth2/clientcredentials" ) +var ( + // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin + ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") +) + const ( // defaultAuthURL is the URL of the production auth endpoint. defaultAuthURL = "https://auth.idp.hashicorp.com" @@ -96,13 +102,6 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { } } - // fail out with a typed error if invoker specified WithoutBrowserLogin - if config.noBrowserLogin { - config.session = &auth.UserSession{ - NoBrowserLogin: true, - } - } - // Set up a token context with the custom auth TLS config tokenTransport := cleanhttp.DefaultPooledTransport() tokenTransport.TLSClientConfig = config.authTLSConfig @@ -122,7 +121,7 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Create token source from the client credentials configuration. config.tokenSource = config.clientCredentialsConfig.TokenSource(tokenContext) - } else { // Set access token via browser login or use token from existing session. + } else if config.oauth2Config.ClientID != NoOAuth2Client { // Set access token via browser login or use token from existing session. tok, err := config.session.GetToken(tokenContext, &config.oauth2Config) if err != nil { @@ -131,6 +130,9 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Update HCPConfig with most current token values. config.tokenSource = config.oauth2Config.TokenSource(tokenContext, tok) + } else { + // if the WithoutBrowserLogin option is passed in and there is no valid login already present return typed error + return nil, ErrorNoValidAuthFound } if err := config.validate(); err != nil { diff --git a/config/with.go b/config/with.go index b78962a7..17485d1a 100644 --- a/config/with.go +++ b/config/with.go @@ -142,7 +142,7 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { // instead force the return of a typed error for users to catch func WithoutBrowserLogin() HCPConfigOption { return func(config *hcpConfig) error { - config.noBrowserLogin = true + config.oauth2Config.ClientID = NoOAuth2Client return nil } } diff --git a/config/with_test.go b/config/with_test.go index b9aadfdd..b39b1476 100644 --- a/config/with_test.go +++ b/config/with_test.go @@ -131,6 +131,6 @@ func TestWithout_BrowserLogin(t *testing.T) { config := &hcpConfig{} require.NoError(apply(config, WithoutBrowserLogin())) - // Ensure flag is set - require.True(config.noBrowserLogin) + // Ensure browser login is disabled + require.Equal(NoOAuth2Client, config.oauth2Config.ClientID) } From 5863a800602b47bba56d15e3ff2bbd2eef329bfc Mon Sep 17 00:00:00 2001 From: lursu Date: Mon, 17 Apr 2023 09:24:20 -0400 Subject: [PATCH 11/17] revert approach for stopping browser login --- auth/user.go | 13 ++++++++++++- config/hcp.go | 7 +++---- config/new.go | 11 +++++++---- config/with.go | 2 +- config/with_test.go | 2 +- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/auth/user.go b/auth/user.go index f957e896..aa7169a0 100644 --- a/auth/user.go +++ b/auth/user.go @@ -5,6 +5,7 @@ package auth import ( "context" + "errors" "fmt" "log" "time" @@ -12,9 +13,15 @@ import ( "golang.org/x/oauth2" ) +var ( + // ErrorNoLocalCredsFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin + ErrorNoLocalCredsFound = errors.New("there were no credentials found present on the machine") +) + // UserSession implements the auth package's Session interface type UserSession struct { - browser Browser + browser Browser + NoBrowserLogin bool } // GetToken returns an access token obtained from either an existing session or new browser login. @@ -33,6 +40,10 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth // If session expiry or the AccessTokenExpiry has passed, then reauthenticate with browser login and reassign token. if readErr != nil || cache.SessionExpiry.Before(time.Now()) || cache.AccessTokenExpiry.Before(time.Now()) { + if s.NoBrowserLogin { + return nil, ErrorNoLocalCredsFound + } + // Login with browser. log.Print("No credentials found, proceeding with browser login.") diff --git a/config/hcp.go b/config/hcp.go index 9e3f78ed..8a61913d 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -14,10 +14,6 @@ import ( "golang.org/x/oauth2/clientcredentials" ) -const ( - NoOAuth2Client = "N/A" -) - // HCPConfig provides configuration values that are useful to interact with HCP. type HCPConfig interface { @@ -99,6 +95,9 @@ type hcpConfig struct { // profile is the user's organization id and project id profile *profile.UserProfile + + // noBrowserLogin is an option to not automatically open browser login in no valid auth method is found. + noBrowserLogin bool } func (c *hcpConfig) Profile() *profile.UserProfile { diff --git a/config/new.go b/config/new.go index 2e4f1085..ffd49c64 100644 --- a/config/new.go +++ b/config/new.go @@ -102,6 +102,12 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { } } + if config.noBrowserLogin { + config.session = &auth.UserSession{ + NoBrowserLogin: true, + } + } + // Set up a token context with the custom auth TLS config tokenTransport := cleanhttp.DefaultPooledTransport() tokenTransport.TLSClientConfig = config.authTLSConfig @@ -121,7 +127,7 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Create token source from the client credentials configuration. config.tokenSource = config.clientCredentialsConfig.TokenSource(tokenContext) - } else if config.oauth2Config.ClientID != NoOAuth2Client { // Set access token via browser login or use token from existing session. + } else { // Set access token via browser login or use token from existing session. tok, err := config.session.GetToken(tokenContext, &config.oauth2Config) if err != nil { @@ -130,9 +136,6 @@ func NewHCPConfig(opts ...HCPConfigOption) (HCPConfig, error) { // Update HCPConfig with most current token values. config.tokenSource = config.oauth2Config.TokenSource(tokenContext, tok) - } else { - // if the WithoutBrowserLogin option is passed in and there is no valid login already present return typed error - return nil, ErrorNoValidAuthFound } if err := config.validate(); err != nil { diff --git a/config/with.go b/config/with.go index 17485d1a..b78962a7 100644 --- a/config/with.go +++ b/config/with.go @@ -142,7 +142,7 @@ func WithProfile(p *profile.UserProfile) HCPConfigOption { // instead force the return of a typed error for users to catch func WithoutBrowserLogin() HCPConfigOption { return func(config *hcpConfig) error { - config.oauth2Config.ClientID = NoOAuth2Client + config.noBrowserLogin = true return nil } } diff --git a/config/with_test.go b/config/with_test.go index b39b1476..d8ec6c43 100644 --- a/config/with_test.go +++ b/config/with_test.go @@ -132,5 +132,5 @@ func TestWithout_BrowserLogin(t *testing.T) { require.NoError(apply(config, WithoutBrowserLogin())) // Ensure browser login is disabled - require.Equal(NoOAuth2Client, config.oauth2Config.ClientID) + require.True(config.noBrowserLogin) } From 2f2ade0639e2b18f1c5eff104a9126d80793c0db Mon Sep 17 00:00:00 2001 From: lursu Date: Mon, 17 Apr 2023 15:46:51 -0400 Subject: [PATCH 12/17] added comments to describe added use case --- README.md | 2 ++ auth/user.go | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 058b7d23..1dc676ef 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ User session is ideal for getting started or one-off usage. It also works for lo To obtain user credentials, the client credential environment variables `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` must be unset. When no client credentials are detected, the HCP Go client will prompt the user with a browser login window. Once authenticated, the user session stays refreshed without intervention until it expires after 24 hours. +If you have a use-case with the SDK to leverage the browser login as a feature but want to control if the browser is opened, or even to understand if the system already has a valid token present. You can pass in the option func of `WithoutBrowserLogin()` to your `NewHCPConfig()`. This will use either use the provided `ClientID`:`ClientSecret` combo or a valid token that has been previously written to the system. If neither option exists then `auth.ErrorNoLocalCredsFound` is returned to indicate that the user is not yet logged in. + ### User Profile An HCP Organization ID and Project ID are required to call most HCP APIs. They can be set to the environment variables `HCP_ORGANIZATION_ID` and `HCP_PROJECT_ID`, as in the example below. The HCP Go SDK will read them from the environment and save them in its state as the user's Profile. The Profile Project and Organization IDs will be applied as default values to any request missing them. diff --git a/auth/user.go b/auth/user.go index aa7169a0..6a09f2c7 100644 --- a/auth/user.go +++ b/auth/user.go @@ -40,6 +40,8 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth // If session expiry or the AccessTokenExpiry has passed, then reauthenticate with browser login and reassign token. if readErr != nil || cache.SessionExpiry.Before(time.Now()) || cache.AccessTokenExpiry.Before(time.Now()) { + // This is a configuration option set by WithoutBrowserLogin to provide control over when or if the browser is opened + // In the case of no valid current login information is found on the system via ClientID:ClientSecret pairing or a previous valid browser login if s.NoBrowserLogin { return nil, ErrorNoLocalCredsFound } From c9f851990cfeb7c3053fd9b8f78e5ee5a55e869f Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Tue, 18 Apr 2023 08:59:41 -0400 Subject: [PATCH 13/17] Update auth/user.go Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- auth/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/user.go b/auth/user.go index 6a09f2c7..f0213613 100644 --- a/auth/user.go +++ b/auth/user.go @@ -14,7 +14,7 @@ import ( ) var ( - // ErrorNoLocalCredsFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin + // ErrorNoLocalCredsFound is returned if no client or user credentials were found and the invoker created the config with the option WithoutBrowserLogin ErrorNoLocalCredsFound = errors.New("there were no credentials found present on the machine") ) From 106d596fd27d58d14abf8cbbc897e63a99877454 Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Tue, 18 Apr 2023 08:59:58 -0400 Subject: [PATCH 14/17] Update config/hcp.go Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- config/hcp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/hcp.go b/config/hcp.go index 8a61913d..e6d90645 100644 --- a/config/hcp.go +++ b/config/hcp.go @@ -96,7 +96,7 @@ type hcpConfig struct { // profile is the user's organization id and project id profile *profile.UserProfile - // noBrowserLogin is an option to not automatically open browser login in no valid auth method is found. + // noBrowserLogin is an option to prevent automatic browser login when no local credentials are found. noBrowserLogin bool } From 39e937a105245c28c7b98ee4a2702fdacccf486f Mon Sep 17 00:00:00 2001 From: lursu Date: Tue, 18 Apr 2023 09:01:04 -0400 Subject: [PATCH 15/17] removed unused error --- config/new.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/config/new.go b/config/new.go index ffd49c64..9273e963 100644 --- a/config/new.go +++ b/config/new.go @@ -5,7 +5,6 @@ package config import ( "crypto/tls" - "errors" "fmt" "net/http" "net/url" @@ -18,11 +17,6 @@ import ( "golang.org/x/oauth2/clientcredentials" ) -var ( - // ErrorNoValidAuthFound is returned if no local auth methods were found and the invoker created the config with the option WithoutBrowserLogin - ErrorNoValidAuthFound = errors.New("there were no valid auth methods found") -) - const ( // defaultAuthURL is the URL of the production auth endpoint. defaultAuthURL = "https://auth.idp.hashicorp.com" From 6d05a1f66ff244fba17463ac079be89f0121cc69 Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Tue, 18 Apr 2023 09:01:38 -0400 Subject: [PATCH 16/17] Update README.md Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1dc676ef..41ff64da 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ User session is ideal for getting started or one-off usage. It also works for lo To obtain user credentials, the client credential environment variables `HCP_CLIENT_ID` and `HCP_CLIENT_SECRET` must be unset. When no client credentials are detected, the HCP Go client will prompt the user with a browser login window. Once authenticated, the user session stays refreshed without intervention until it expires after 24 hours. -If you have a use-case with the SDK to leverage the browser login as a feature but want to control if the browser is opened, or even to understand if the system already has a valid token present. You can pass in the option func of `WithoutBrowserLogin()` to your `NewHCPConfig()`. This will use either use the provided `ClientID`:`ClientSecret` combo or a valid token that has been previously written to the system. If neither option exists then `auth.ErrorNoLocalCredsFound` is returned to indicate that the user is not yet logged in. +If you have a use-case with the SDK to leverage the browser login as a feature but want to control if the browser is opened, or even to understand if the system already has a valid token present, you can pass in the option func of `WithoutBrowserLogin()` to your `NewHCPConfig()`. This will use either the provided `ClientID`:`ClientSecret` combo or a valid token that has been previously written to the system. If neither option exists, then `auth.ErrorNoLocalCredsFound` is returned to indicate that the user is not yet logged in. ### User Profile From 00e72235350d61e000a6e650431f20e9b0860be8 Mon Sep 17 00:00:00 2001 From: Leland Ursu Date: Tue, 18 Apr 2023 09:01:48 -0400 Subject: [PATCH 17/17] Update auth/user.go Co-authored-by: Brenna Hewer-Darroch <21015366+bcmdarroch@users.noreply.github.com> --- auth/user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/auth/user.go b/auth/user.go index f0213613..15ae3cfb 100644 --- a/auth/user.go +++ b/auth/user.go @@ -41,7 +41,7 @@ func (s *UserSession) GetToken(ctx context.Context, conf *oauth2.Config) (*oauth if readErr != nil || cache.SessionExpiry.Before(time.Now()) || cache.AccessTokenExpiry.Before(time.Now()) { // This is a configuration option set by WithoutBrowserLogin to provide control over when or if the browser is opened - // In the case of no valid current login information is found on the system via ClientID:ClientSecret pairing or a previous valid browser login + // When the flag is true and no valid credentials are found on the system via ClientID:ClientSecret pairing or a previous unexpired browser login, the client returns an error instead of automatically opening a browser if s.NoBrowserLogin { return nil, ErrorNoLocalCredsFound }