Skip to content

Commit

Permalink
PLT-1403:Added support for PCG DNS Map (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
SivaanandM authored Oct 22, 2024
1 parent 6925f4d commit 3782615
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions client/private_cloud_gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,3 +318,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 {
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 {
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) {
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 3782615

Please sign in to comment.