-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[minor_change] Add models and clients for cloudServiceEPg, cloudPriva…
…teLinkLabel and cloudSvcEpSelector (#281)
- Loading branch information
Showing
6 changed files
with
1,054 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
Oops, something went wrong.