Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLT-1403:Added support for PCG DNS Map #135

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading