-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from cisco-en-programmability/develop
## 1.2.0-beta (September 5, 2024)
- Loading branch information
Showing
1,841 changed files
with
169,625 additions
and
34,627 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
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 |
---|---|---|
|
@@ -51,4 +51,6 @@ vendor/ | |
*.log | ||
|
||
# Shell | ||
.sh | ||
.sh | ||
|
||
env.sh |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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,92 @@ | ||
package dnacenter | ||
|
||
import ( | ||
"context" | ||
|
||
"log" | ||
|
||
dnacentersdkgo "github.com/cisco-en-programmability/dnacenter-go-sdk/v6/sdk" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
func dataSourceAnalyticsAncPolicies() *schema.Resource { | ||
return &schema.Resource{ | ||
Description: `It performs read operation on AI Endpoint Analytics. | ||
- Fetches the list of ANC policies available in ISE. | ||
`, | ||
|
||
ReadContext: dataSourceAnalyticsAncPoliciesRead, | ||
Schema: map[string]*schema.Schema{ | ||
|
||
"items": &schema.Schema{ | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
|
||
"name": &schema.Schema{ | ||
Description: `Name of the ANC policy. | ||
`, | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func dataSourceAnalyticsAncPoliciesRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { | ||
client := m.(*dnacentersdkgo.Client) | ||
|
||
var diags diag.Diagnostics | ||
|
||
selectedMethod := 1 | ||
if selectedMethod == 1 { | ||
log.Printf("[DEBUG] Selected method: GetAncPolicies") | ||
|
||
response1, restyResp1, err := client.AIEndpointAnalytics.GetAncPolicies() | ||
|
||
if err != nil || response1 == nil { | ||
if restyResp1 != nil { | ||
log.Printf("[DEBUG] Retrieved error response %s", restyResp1.String()) | ||
} | ||
diags = append(diags, diagErrorWithAlt( | ||
"Failure when executing 2 GetAncPolicies", err, | ||
"Failure at GetAncPolicies, unexpected response", "")) | ||
return diags | ||
} | ||
|
||
log.Printf("[DEBUG] Retrieved response %+v", responseInterfaceToString(*response1)) | ||
|
||
vItems1 := flattenAIEndpointAnalyticsGetAncPoliciesItems(response1) | ||
if err := d.Set("items", vItems1); err != nil { | ||
diags = append(diags, diagError( | ||
"Failure when setting GetAncPolicies response", | ||
err)) | ||
return diags | ||
} | ||
|
||
d.SetId(getUnixTimeString()) | ||
return diags | ||
|
||
} | ||
return diags | ||
} | ||
|
||
func flattenAIEndpointAnalyticsGetAncPoliciesItems(items *dnacentersdkgo.ResponseAIEndpointAnalyticsGetAncPolicies) []map[string]interface{} { | ||
if items == nil { | ||
return nil | ||
} | ||
var respItems []map[string]interface{} | ||
for _, item := range *items { | ||
respItem := make(map[string]interface{}) | ||
respItem["name"] = item.Name | ||
respItems = append(respItems, respItem) | ||
} | ||
return respItems | ||
} |
Oops, something went wrong.