diff --git a/CHANGELOG.md b/CHANGELOG.md index 472a7a5..bc4d625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.0.21] - 2023-11-20 +- `ResponseConfigurationTemplatesGetProjectsDetails` is now an array. + ## [5.0.20] - 2023-11-20 ### Changed - `ResponseNetworkSettingsGetReserveIPSubpoolResponse` changes response. @@ -589,4 +592,5 @@ Services removed on Cisco DNA Center 2.3.3.0's API: [5.0.18]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.17...v5.0.18 [5.0.19]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.18...v5.0.19 [5.0.20]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.19...v5.0.20 -[Unreleased]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.20...main +[5.0.21]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.20...v5.0.21 +[Unreleased]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.21...main diff --git a/examples/configuration_templates/main.go b/examples/configuration_templates/main.go index a682de1..4b5b85f 100644 --- a/examples/configuration_templates/main.go +++ b/examples/configuration_templates/main.go @@ -1,6 +1,7 @@ package main import ( + "encoding/json" "fmt" dnac "github.com/cisco-en-programmability/dnacenter-go-sdk/v5/sdk" @@ -9,80 +10,94 @@ import ( // client is DNA Center API client var client *dnac.Client +func responseInterfaceToString(v interface{}) string { + b, err := json.Marshal(v) + if err != nil { + return fmt.Sprint(v) + } + return fmt.Sprint(string(b)) +} + func main() { var err error - projectID := "" - templateId := "" + // projectID := "" + // templateId := "" fmt.Println("Authenticating...") - client, err = dnac.NewClientWithOptions("https://192.168.196.2/", - "altus", "Altus123", + client, err = dnac.NewClientWithOptions("https://100.119.103.190", + "cloverhound_user", "LABchsys!23$", "true", "false", nil) if err != nil { fmt.Println(err) return } - fmt.Println("Printing GetsAListOfProjects") - getListOfProjectsQueryParams := &dnac.GetsAListOfProjectsQueryParams{} - respListOfProjects, _, err := client.ConfigurationTemplates.GetsAListOfProjects(getListOfProjectsQueryParams) - if err != nil { - fmt.Println(err) - return - } - - if respListOfProjects != nil { - fmt.Println(respListOfProjects) - projectID = (*respListOfProjects)[0].ID - } else { - fmt.Println("There's no data on GetsAListOfProjects response") - return - } - - fmt.Println("Printing DetailsOfAGivenProject") - respDetailsOfAGivenProject, _, err := client.ConfigurationTemplates.GetsTheDetailsOfAGivenProject(projectID) - if err != nil { - fmt.Println(err) - return - } - - if respDetailsOfAGivenProject != nil { - fmt.Println(respDetailsOfAGivenProject) - } else { - fmt.Println("There's no data on DetailsOfAGivenProject response") - return - } - - fmt.Println("Printing GetsTheTemplatesAvailable") - getTemplatesAvailableQueryParams := &dnac.GetsTheTemplatesAvailableQueryParams{} - respTemplatesAvailable, _, err := client.ConfigurationTemplates.GetsTheTemplatesAvailable(getTemplatesAvailableQueryParams) - if err != nil { - fmt.Println(err) - return - } - - if respTemplatesAvailable != nil { - fmt.Println(respTemplatesAvailable) - templateId = (*respTemplatesAvailable)[0].TemplateID - } else { - fmt.Println("There's no data on GetsTheTemplatesAvailable response") - return - } - - //Print StatusOfTemplateDeployment can't test - - fmt.Println("Printng GetsAllTheVersionsOfAGivenTemplate") - respAllTheVersionsOfAGivenTemplate, _, err := client.ConfigurationTemplates.GetsAllTheVersionsOfAGivenTemplate(templateId) - if err != nil { - fmt.Println(err) - return - } - - if respAllTheVersionsOfAGivenTemplate != nil { - fmt.Println(respAllTheVersionsOfAGivenTemplate) - } else { - fmt.Println("There's no data on GetsAllTheVersionsOfAGivenTemplate response") - return - } + // fmt.Println("Printing GetsAListOfProjects") + // getListOfProjectsQueryParams := &dnac.GetsAListOfProjectsQueryParams{} + // respListOfProjects, _, err := client.ConfigurationTemplates.GetsAListOfProjects(getListOfProjectsQueryParams) + // if err != nil { + // fmt.Println(err) + // return + // } + + // if respListOfProjects != nil { + // fmt.Println(respListOfProjects) + // projectID = (*respListOfProjects)[0].ID + // } else { + // fmt.Println("There's no data on GetsAListOfProjects response") + // return + // } + + // fmt.Println("Printing DetailsOfAGivenProject") + // respDetailsOfAGivenProject, _, err := client.ConfigurationTemplates.GetsTheDetailsOfAGivenProject(projectID) + // if err != nil { + // fmt.Println(err) + // return + // } + + // if respDetailsOfAGivenProject != nil { + // fmt.Println(respDetailsOfAGivenProject) + // } else { + // fmt.Println("There's no data on DetailsOfAGivenProject response") + // return + // } + + // fmt.Println("Printing GetsTheTemplatesAvailable") + // getTemplatesAvailableQueryParams := &dnac.GetsTheTemplatesAvailableQueryParams{} + // respTemplatesAvailable, _, err := client.ConfigurationTemplates.GetsTheTemplatesAvailable(getTemplatesAvailableQueryParams) + // if err != nil { + // fmt.Println(err) + // return + // } + + // if respTemplatesAvailable != nil { + // fmt.Println(respTemplatesAvailable) + // templateId = (*respTemplatesAvailable)[0].TemplateID + // } else { + // fmt.Println("There's no data on GetsTheTemplatesAvailable response") + // return + // } + + // //Print StatusOfTemplateDeployment can't test + + // fmt.Println("Printng GetsAllTheVersionsOfAGivenTemplate") + // respAllTheVersionsOfAGivenTemplate, _, err := client.ConfigurationTemplates.GetsAllTheVersionsOfAGivenTemplate(templateId) + // if err != nil { + // fmt.Println(err) + // return + // } + + // if respAllTheVersionsOfAGivenTemplate != nil { + // fmt.Println(respAllTheVersionsOfAGivenTemplate) + // } else { + // fmt.Println("There's no data on GetsAllTheVersionsOfAGivenTemplate response") + // return + // } + + resp, _, err := client.ConfigurationTemplates.GetProjectsDetails(&dnac.GetProjectsDetailsQueryParams{ + Name: "Onboarding Configuration", + }) + + println(responseInterfaceToString(resp)) // /v2 endpoints can't test diff --git a/sdk/configuration_templates.go b/sdk/configuration_templates.go index 2f6f93d..63f2bb7 100644 --- a/sdk/configuration_templates.go +++ b/sdk/configuration_templates.go @@ -868,7 +868,12 @@ type ResponseConfigurationTemplatesGetsDetailsOfAGivenTemplateValidationErrors s } type ResponseConfigurationTemplatesGetsDetailsOfAGivenTemplateValidationErrorsRollbackTemplateErrors interface{} type ResponseConfigurationTemplatesGetsDetailsOfAGivenTemplateValidationErrorsTemplateErrors interface{} + type ResponseConfigurationTemplatesGetProjectsDetails struct { + Response []ResponseConfigurationTemplatesGetProjectsDetailsResponse `json:"response,omitempty"` // Response +} + +type ResponseConfigurationTemplatesGetProjectsDetailsResponse struct { CreateTime *int `json:"createTime,omitempty"` // Create time of project Description string `json:"description,omitempty"` // Description of project ID string `json:"id,omitempty"` // UUID of project