Skip to content

Commit

Permalink
Merge pull request #162 from ans-group/vpn-gw-missing-fields
Browse files Browse the repository at this point in the history
Add missing hostname/fqdn fields to VPN GW model
  • Loading branch information
Xiol authored Nov 11, 2024
2 parents b73951d + ce0c150 commit 65414da
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 60 deletions.
27 changes: 27 additions & 0 deletions pkg/service/ecloud/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
62 changes: 2 additions & 60 deletions pkg/service/ecloud/model.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package ecloud

import (
"fmt"

"github.com/ans-group/sdk-go/pkg/connection"
)

Expand Down Expand Up @@ -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"`
Expand All @@ -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)
}
26 changes: 26 additions & 0 deletions pkg/service/ecloud/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

0 comments on commit 65414da

Please sign in to comment.