Skip to content

Commit

Permalink
PLT-1403:Added support for PCG DNS Map
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM committed Oct 21, 2024
1 parent 6925f4d commit 83d2821
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion client/private_cloud_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package client
import (
"errors"
"fmt"

clientv1 "github.com/spectrocloud/palette-sdk-go/api/client/v1"
"github.com/spectrocloud/palette-sdk-go/api/models"
"github.com/spectrocloud/palette-sdk-go/client/apiutil"
Expand Down Expand Up @@ -318,3 +317,51 @@ func (h *V1Client) DeleteIPPool(pcgUID, poolUID string) error {
_, err := h.Client.V1OverlordsUIDPoolDelete(params)
return err
}

// CreateVsphereDNSMap creates a new DNS Mapping for a Private Cloud Gateway.
func (h *V1Client) CreateVsphereDNSMap(dnsMapBody *models.V1VsphereDNSMapping) (string, error) {
params := clientv1.NewV1VsphereDNSMappingCreateParamsWithContext(h.ctx).WithBody(dnsMapBody)
resp, err := h.Client.V1VsphereDNSMappingCreate(params)
if err != nil {
return "", err
}
return *resp.Payload.UID, nil
}

// UpdateVsphereDNSMap update an existing DNS Mapping for a Private Cloud Gateway
func (h *V1Client) UpdateVsphereDNSMap(dnsMapId string, dnsMapBody *models.V1VsphereDNSMapping) error {

Check failure on line 332 in client/private_cloud_gateway.go

View workflow job for this annotation

GitHub Actions / build-with-coverage

var-naming: method parameter dnsMapId should be dnsMapID (revive)
params := clientv1.NewV1VsphereDNSMappingUpdateParamsWithContext(h.ctx).WithUID(dnsMapId).WithBody(dnsMapBody)
_, err := h.Client.V1VsphereDNSMappingUpdate(params)
return err
}

// DeleteVsphereDNSMap delete an existing DNS Mapping for a Private Cloud Gateway
func (h *V1Client) DeleteVsphereDNSMap(dnsMapId string) error {

Check failure on line 339 in client/private_cloud_gateway.go

View workflow job for this annotation

GitHub Actions / build-with-coverage

var-naming: method parameter dnsMapId should be dnsMapID (revive)
params := clientv1.NewV1VsphereDNSMappingDeleteParamsWithContext(h.ctx).WithUID(dnsMapId)
_, err := h.Client.V1VsphereDNSMappingDelete(params)
if err != nil {
return err
}
return nil
}

// GetVsphereDNSMap get an existing DNS Mapping for a Private Cloud Gateway
func (h *V1Client) GetVsphereDNSMap(dnsMapId string) (*models.V1VsphereDNSMapping, error) {

Check failure on line 349 in client/private_cloud_gateway.go

View workflow job for this annotation

GitHub Actions / build-with-coverage

var-naming: method parameter dnsMapId should be dnsMapID (revive)
params := clientv1.NewV1VsphereDNSMappingGetParamsWithContext(h.ctx).WithUID(dnsMapId)
resp, err := h.Client.V1VsphereDNSMappingGet(params)
if err != nil {
return nil, err
}
return resp.Payload, nil
}

// GetVsphereDNSMappingsByPCGId get an existing DNS Mappings for a Private Cloud Gateway with PCG-ID
func (h *V1Client) GetVsphereDNSMappingsByPCGId(PCGId string) (*models.V1VsphereDNSMappings, error) {
filter := "spec.privateGatewayUid=" + PCGId
params := clientv1.NewV1VsphereDNSMappingsGetParamsWithContext(h.ctx).WithFilters(&filter)
resp, err := h.Client.V1VsphereDNSMappingsGet(params)
if err != nil {
return nil, err
}
return resp.Payload, nil
}

0 comments on commit 83d2821

Please sign in to comment.