Skip to content

Commit

Permalink
[minor_change] Add models and clients for cloudServiceEPg, cloudPriva…
Browse files Browse the repository at this point in the history
…teLinkLabel and cloudSvcEpSelector (#281)
  • Loading branch information
gmicol authored Aug 24, 2023
1 parent 406408a commit ee338a0
Show file tree
Hide file tree
Showing 6 changed files with 1,054 additions and 0 deletions.
56 changes: 56 additions & 0 deletions client/cloudPrivateLinkLabel_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package client

import (
"fmt"

"github.com/ciscoecosystem/aci-go-client/v2/models"
)

func (sm *ServiceManager) CreateCloudPrivateLinkLabel(name string, parentDn string, description string, cloudPrivateLinkLabelAttr models.CloudPrivateLinkLabelAttributes) (*models.CloudPrivateLinkLabel, error) {

rn := fmt.Sprintf(models.RnCloudPrivateLinkLabel, name)
cloudPrivateLinkLabel := models.NewCloudPrivateLinkLabel(rn, parentDn, description, cloudPrivateLinkLabelAttr)

err := sm.Save(cloudPrivateLinkLabel)
return cloudPrivateLinkLabel, err
}

func (sm *ServiceManager) ReadCloudPrivateLinkLabel(name string, parentDn string) (*models.CloudPrivateLinkLabel, error) {

rn := fmt.Sprintf(models.RnCloudPrivateLinkLabel, name)
dn := fmt.Sprintf("%s/%s", parentDn, rn)

cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
cloudPrivateLinkLabel := models.CloudPrivateLinkLabelFromContainer(cont)
return cloudPrivateLinkLabel, nil
}

func (sm *ServiceManager) DeleteCloudPrivateLinkLabel(name string, parentDn string) error {

rn := fmt.Sprintf(models.RnCloudPrivateLinkLabel, name)
dn := fmt.Sprintf("%s/%s", parentDn, rn)

return sm.DeleteByDn(dn, models.CloudPrivateLinkLabelClassName)
}

func (sm *ServiceManager) UpdateCloudPrivateLinkLabel(name string, parentDn string, description string, cloudPrivateLinkLabelAttr models.CloudPrivateLinkLabelAttributes) (*models.CloudPrivateLinkLabel, error) {

rn := fmt.Sprintf(models.RnCloudPrivateLinkLabel, name)
cloudPrivateLinkLabel := models.NewCloudPrivateLinkLabel(rn, parentDn, description, cloudPrivateLinkLabelAttr)

cloudPrivateLinkLabel.Status = "modified"
err := sm.Save(cloudPrivateLinkLabel)
return cloudPrivateLinkLabel, err
}

func (sm *ServiceManager) ListCloudPrivateLinkLabel(parentDn string) ([]*models.CloudPrivateLinkLabel, error) {

dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.CloudPrivateLinkLabelClassName)

cont, err := sm.GetViaURL(dnUrl)
list := models.CloudPrivateLinkLabelListFromContainer(cont)
return list, err
}
65 changes: 65 additions & 0 deletions client/cloudSvcEPSelector_service.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package client

import (
"fmt"

"github.com/ciscoecosystem/aci-go-client/v2/models"
)

func (sm *ServiceManager) CreateCloudServiceEndpointSelector(name string, cloud_service_epg string, cloud_application_container string, tenant string, description string, cloudSvcEPSelectorAttr models.CloudServiceEndpointSelectorAttributes) (*models.CloudServiceEndpointSelector, error) {

rn := fmt.Sprintf(models.RnCloudSvcEPSelector, name)

parentDn := fmt.Sprintf(models.ParentDnCloudSvcEPSelector, tenant, cloud_application_container, cloud_service_epg)
cloudSvcEPSelector := models.NewCloudServiceEndpointSelector(rn, parentDn, description, cloudSvcEPSelectorAttr)

err := sm.Save(cloudSvcEPSelector)
return cloudSvcEPSelector, err
}

func (sm *ServiceManager) ReadCloudServiceEndpointSelector(name string, cloud_service_epg string, cloud_application_container string, tenant string) (*models.CloudServiceEndpointSelector, error) {

rn := fmt.Sprintf(models.RnCloudSvcEPSelector, name)

parentDn := fmt.Sprintf(models.ParentDnCloudSvcEPSelector, tenant, cloud_application_container, cloud_service_epg)
dn := fmt.Sprintf("%s/%s", parentDn, rn)

cont, err := sm.Get(dn)
if err != nil {
return nil, err
}
cloudSvcEPSelector := models.CloudServiceEndpointSelectorFromContainer(cont)
return cloudSvcEPSelector, nil
}

func (sm *ServiceManager) DeleteCloudServiceEndpointSelector(name string, cloud_service_epg string, cloud_application_container string, tenant string) error {

rn := fmt.Sprintf(models.RnCloudSvcEPSelector, name)

parentDn := fmt.Sprintf(models.ParentDnCloudSvcEPSelector, tenant, cloud_application_container, cloud_service_epg)
dn := fmt.Sprintf("%s/%s", parentDn, rn)

return sm.DeleteByDn(dn, models.CloudSvcEPSelectorClassName)
}

func (sm *ServiceManager) UpdateCloudServiceEndpointSelector(name string, cloud_service_epg string, cloud_application_container string, tenant string, description string, cloudSvcEPSelectorAttr models.CloudServiceEndpointSelectorAttributes) (*models.CloudServiceEndpointSelector, error) {

rn := fmt.Sprintf(models.RnCloudSvcEPSelector, name)

parentDn := fmt.Sprintf(models.ParentDnCloudSvcEPSelector, tenant, cloud_application_container, cloud_service_epg)
cloudSvcEPSelector := models.NewCloudServiceEndpointSelector(rn, parentDn, description, cloudSvcEPSelectorAttr)

cloudSvcEPSelector.Status = "modified"
err := sm.Save(cloudSvcEPSelector)
return cloudSvcEPSelector, err
}

func (sm *ServiceManager) ListCloudServiceEndpointSelector(cloud_service_epg string, cloud_application_container string, tenant string) ([]*models.CloudServiceEndpointSelector, error) {

parentDn := fmt.Sprintf(models.ParentDnCloudSvcEPSelector, tenant, cloud_application_container, cloud_service_epg)
dnUrl := fmt.Sprintf("%s/%s/%s.json", models.BaseurlStr, parentDn, models.CloudSvcEPSelectorClassName)

cont, err := sm.GetViaURL(dnUrl)
list := models.CloudServiceEndpointSelectorListFromContainer(cont)
return list, err
}
Loading

0 comments on commit ee338a0

Please sign in to comment.