// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT.

package armsecurityinsights_test

import (
	"context"
	"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
	"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2"
	"log"
)

// Generated from example definition: 2025-07-01-preview/threatintelligence/PostThreatIntelligenceCount.json
func ExampleThreatIntelligenceClient_Count() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsecurityinsights.NewClientFactory("bd794837-4d29-4647-9105-6339bfdb4e6a", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	res, err := clientFactory.NewThreatIntelligenceClient().Count(ctx, "myRg", "myWorkspace", armsecurityinsights.TiTypeMain, nil)
	if err != nil {
		log.Fatalf("failed to finish the request: %v", err)
	}
	// You could use response here. We use blank identifier for just demo purposes.
	_ = res
	// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
	// res = armsecurityinsights.ThreatIntelligenceClientCountResponse{
	// 	ThreatIntelligenceCount: armsecurityinsights.ThreatIntelligenceCount{
	// 		Count: to.Ptr[int32](3),
	// 	},
	// }
}

// Generated from example definition: 2025-07-01-preview/threatintelligence/PostThreatIntelligenceQuery.json
func ExampleThreatIntelligenceClient_NewQueryPager() {
	cred, err := azidentity.NewDefaultAzureCredential(nil)
	if err != nil {
		log.Fatalf("failed to obtain a credential: %v", err)
	}
	ctx := context.Background()
	clientFactory, err := armsecurityinsights.NewClientFactory("bd794837-4d29-4647-9105-6339bfdb4e6a", cred, nil)
	if err != nil {
		log.Fatalf("failed to create client: %v", err)
	}
	pager := clientFactory.NewThreatIntelligenceClient().NewQueryPager("myRg", "myWorkspace", armsecurityinsights.TiTypeMain, nil)
	for pager.More() {
		page, err := pager.NextPage(ctx)
		if err != nil {
			log.Fatalf("failed to advance page: %v", err)
		}
		for _, v := range page.Value {
			// You could use page here. We use blank identifier for just demo purposes.
			_ = v
		}
		// If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
		// page = armsecurityinsights.ThreatIntelligenceClientQueryResponse{
		// 	ThreatIntelligenceList: armsecurityinsights.ThreatIntelligenceList{
		// 		Value: []armsecurityinsights.TIObjectClassification{
		// 			&armsecurityinsights.AttackPattern{
		// 				Name: to.Ptr("dGxwLW1peGVkVHlwZXMtd2l0aC1SdWxlcy0y---attack-pattern--fb6aa549-c94a-4e45-b4fd-7e32602dad85"),
		// 				Type: to.Ptr("Microsoft.SecurityInsights/threatintelligence"),
		// 				ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/threatintelligence/dGxwLW1peGVkVHlwZXMtd2l0aC1SdWxlcy0y---attack-pattern--fb6aa549-c94a-4e45-b4fd-7e32602dad85"),
		// 				Kind: to.Ptr(armsecurityinsights.TIObjectKindAttackPattern),
		// 				Properties: &armsecurityinsights.TIObjectCommonProperties{
		// 					CreatedBy: &armsecurityinsights.UserInfo{
		// 						Name: to.Ptr(""),
		// 						Email: to.Ptr(""),
		// 						ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 					},
		// 					Data: map[string]any{
		// 						"name": "Attack Pattern 2.1",
		// 						"type": "attack-pattern",
		// 						"description": "menuPass appears to favor spear phishing to deliver payloads to the intended targets. While the attackers behind menuPass have used other RATs in their campaign, it appears that they use PIVY as their primary persistence mechanism.",
		// 						"aliases": []any{
		// 							"alias_1",
		// 							"alias_2",
		// 						},
		// 						"confidence": 100,
		// 						"created": "2015-05-15T09:12:16.432Z",
		// 						"created_by_ref": "identity--f431f809-377b-45e0-aa1c-6a4751cae5ff",
		// 						"external_references": []any{
		// 							map[string]any{
		// 								"description": "spear phishing",
		// 								"external_id": "CAPEC-163",
		// 								"hashes": nil,
		// 								"source_name": "capec",
		// 								"url": nil,
		// 							},
		// 						},
		// 						"granular_markings": []any{
		// 							map[string]any{
		// 								"lang": "en",
		// 								"marking_ref": "marking-definition--089a6ecb-cc15-43cc-9494-767639779123",
		// 								"selectors": []any{
		// 									"description",
		// 									"labels",
		// 								},
		// 							},
		// 						},
		// 						"id": "attack-pattern--fb6aa549-c94a-4e45-b4fd-7e32602dad85",
		// 						"kill_chain_phases": []any{
		// 							map[string]any{
		// 								"kill_chain_name": "mandiant-attack-lifecycle-model",
		// 								"phase_name": "initial-compromise",
		// 							},
		// 						},
		// 						"labels": []any{
		// 							"heartbleed",
		// 							"has-logo",
		// 						},
		// 						"lang": "en",
		// 						"modified": "2015-05-20T09:12:16.432Z",
		// 						"object_marking_refs": []any{
		// 							"marking-definition--34098fce-860f-48ae-8e50-ebd3cc5e41da",
		// 						},
		// 						"revoked": true,
		// 						"spec_version": "2.1",
		// 						"extensions": map[string]any{
		// 							"extension-definition--d83fce45-ef58-4c6c-a3f4-1fbc32e98c6e": map[string]any{
		// 								"extension_type": "property-extension",
		// 								"rank": 5,
		// 								"toxicity": 8,
		// 							},
		// 							"sentinel-ext": map[string]any{
		// 								"severity": nil,
		// 							},
		// 						},
		// 					},
		// 					FirstIngestedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-05T22:47:29.4948816"); return t}()),
		// 					IngestionRulesVersion: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 					LastIngestedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-05T22:47:29.4948816"); return t}()),
		// 					LastModifiedBy: &armsecurityinsights.UserInfo{
		// 						Name: to.Ptr(""),
		// 						Email: to.Ptr(""),
		// 						ObjectID: to.Ptr("00000000-0000-0000-0000-000000000000"),
		// 					},
		// 					LastUpdateMethod: to.Ptr("File Import"),
		// 					LastUpdatedDateTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-05T22:47:29.4948816"); return t}()),
		// 					Source: to.Ptr("mySource"),
		// 				},
		// 			},
		// 		},
		// 	},
		// }
	}
}
