From ce0c150c5fc970f573da44164c1b70c734ee593f Mon Sep 17 00:00:00 2001 From: Dane Elwell Date: Mon, 11 Nov 2024 15:03:45 +0000 Subject: [PATCH] Add missing hostname/fqdn fields to VPN GW model Also relocates structs to correct files --- pkg/service/ecloud/error.go | 27 +++++++++++++++ pkg/service/ecloud/model.go | 62 ++--------------------------------- pkg/service/ecloud/request.go | 26 +++++++++++++++ 3 files changed, 55 insertions(+), 60 deletions(-) diff --git a/pkg/service/ecloud/error.go b/pkg/service/ecloud/error.go index 068e818..5d05fd4 100644 --- a/pkg/service/ecloud/error.go +++ b/pkg/service/ecloud/error.go @@ -469,3 +469,30 @@ type IOPSNotFoundError struct { func (e *IOPSNotFoundError) Error() string { return fmt.Sprintf("IOPS tier not found with ID [%s]", e.ID) } + +// VPNGatewayNotFoundError represents a VPN gateway not found error +type VPNGatewayNotFoundError struct { + ID string +} + +func (e *VPNGatewayNotFoundError) Error() string { + return fmt.Sprintf("VPN gateway not found with ID [%s]", e.ID) +} + +// VPNGatewaySpecificationNotFoundError represents a VPN gateway specification not found error +type VPNGatewaySpecificationNotFoundError struct { + ID string +} + +func (e *VPNGatewaySpecificationNotFoundError) Error() string { + return fmt.Sprintf("VPN gateway specification not found with ID [%s]", e.ID) +} + +// VPNGatewayUserNotFoundError represents a VPN gateway user not found error +type VPNGatewayUserNotFoundError struct { + ID string +} + +func (e *VPNGatewayUserNotFoundError) Error() string { + return fmt.Sprintf("VPN gateway user not found with ID [%s]", e.ID) +} diff --git a/pkg/service/ecloud/model.go b/pkg/service/ecloud/model.go index bf40235..b33dbd4 100644 --- a/pkg/service/ecloud/model.go +++ b/pkg/service/ecloud/model.go @@ -1,8 +1,6 @@ package ecloud import ( - "fmt" - "github.com/ans-group/sdk-go/pkg/connection" ) @@ -1037,24 +1035,14 @@ type VPNGateway struct { Name string `json:"name"` RouterID string `json:"router_id"` SpecificationID string `json:"specification_id"` + Hostname string `json:"hostname"` + FQDN string `json:"fqdn"` Sync ResourceSync `json:"sync"` Task ResourceTask `json:"task"` CreatedAt connection.DateTime `json:"created_at"` UpdatedAt connection.DateTime `json:"updated_at"` } -// CreateVPNGatewayRequest represents a request to create a VPN gateway -type CreateVPNGatewayRequest struct { - Name string `json:"name,omitempty"` - RouterID string `json:"router_id"` - SpecificationID string `json:"specification_id"` -} - -// PatchVPNGatewayRequest represents a request to patch a VPN gateway -type PatchVPNGatewayRequest struct { - Name string `json:"name,omitempty"` -} - // VPNGatewaySpecification represents a VPN gateway specification type VPNGatewaySpecification struct { ID string `json:"id"` @@ -1075,49 +1063,3 @@ type VPNGatewayUser struct { CreatedAt connection.DateTime `json:"created_at"` UpdatedAt connection.DateTime `json:"updated_at"` } - -// CreateVPNGatewayUserRequest represents a request to create a VPN gateway user -type CreateVPNGatewayUserRequest struct { - Name string `json:"name,omitempty"` - VPNGatewayID string `json:"vpn_gateway_id"` - Username string `json:"username"` - Password string `json:"password"` -} - -// PatchVPNGatewayUserRequest represents a request to patch a VPN gateway user -type PatchVPNGatewayUserRequest struct { - Name string `json:"name,omitempty"` - Password string `json:"password,omitempty"` -} - -// PatchVPNGatewayUserCredentialRequest represents a request to update VPN gateway user credentials -type PatchVPNGatewayUserCredentialRequest struct { - Password string `json:"password"` -} - -// VPNGatewayNotFoundError represents a VPN gateway not found error -type VPNGatewayNotFoundError struct { - ID string -} - -func (e *VPNGatewayNotFoundError) Error() string { - return fmt.Sprintf("VPN gateway not found with ID [%s]", e.ID) -} - -// VPNGatewaySpecificationNotFoundError represents a VPN gateway specification not found error -type VPNGatewaySpecificationNotFoundError struct { - ID string -} - -func (e *VPNGatewaySpecificationNotFoundError) Error() string { - return fmt.Sprintf("VPN gateway specification not found with ID [%s]", e.ID) -} - -// VPNGatewayUserNotFoundError represents a VPN gateway user not found error -type VPNGatewayUserNotFoundError struct { - ID string -} - -func (e *VPNGatewayUserNotFoundError) Error() string { - return fmt.Sprintf("VPN gateway user not found with ID [%s]", e.ID) -} diff --git a/pkg/service/ecloud/request.go b/pkg/service/ecloud/request.go index 5faf768..cfd18fa 100644 --- a/pkg/service/ecloud/request.go +++ b/pkg/service/ecloud/request.go @@ -636,3 +636,29 @@ type ExecuteInstanceScriptRequest struct { Username string `json:"username"` Password string `json:"password"` } + +// CreateVPNGatewayRequest represents a request to create a VPN gateway +type CreateVPNGatewayRequest struct { + Name string `json:"name,omitempty"` + RouterID string `json:"router_id"` + SpecificationID string `json:"specification_id"` +} + +// PatchVPNGatewayRequest represents a request to patch a VPN gateway +type PatchVPNGatewayRequest struct { + Name string `json:"name,omitempty"` +} + +// CreateVPNGatewayUserRequest represents a request to create a VPN gateway user +type CreateVPNGatewayUserRequest struct { + Name string `json:"name,omitempty"` + VPNGatewayID string `json:"vpn_gateway_id"` + Username string `json:"username"` + Password string `json:"password"` +} + +// PatchVPNGatewayUserRequest represents a request to patch a VPN gateway user +type PatchVPNGatewayUserRequest struct { + Name string `json:"name,omitempty"` + Password string `json:"password,omitempty"` +}