-
Notifications
You must be signed in to change notification settings - Fork 12
/
Attestations_GetSubscriptionScope.go
61 lines (58 loc) · 3.44 KB
/
Attestations_GetSubscriptionScope.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package armpolicyinsights_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/policyinsights/armpolicyinsights"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/05a9cdab363b8ec824094ee73950c04594325172/specification/policyinsights/resource-manager/Microsoft.PolicyInsights/stable/2022-09-01/examples/Attestations_GetSubscriptionScope.json
func ExampleAttestationsClient_GetAtSubscription() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armpolicyinsights.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewAttestationsClient().GetAtSubscription(ctx, "790996e6-9871-4b1f-9cd9-ec42cd6ced1e", 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.Attestation = armpolicyinsights.Attestation{
// Name: to.Ptr("790996e6-9871-4b1f-9cd9-ec42cd6ced1e"),
// Type: to.Ptr("Microsoft.PolicyInsights/attestations"),
// ID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.policyinsights/attestations/790996e6-9871-4b1f-9cd9-ec42cd6ced1e"),
// Properties: &armpolicyinsights.AttestationProperties{
// AssessmentDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T00:00:00Z"); return t}()),
// Comments: to.Ptr("This subscription has passed a security audit."),
// ComplianceState: to.Ptr(armpolicyinsights.ComplianceStateCompliant),
// Evidence: []*armpolicyinsights.AttestationEvidence{
// {
// Description: to.Ptr("The results of the security audit."),
// SourceURI: to.Ptr("https://gist.github.com/contoso/9573e238762c60166c090ae16b814011"),
// }},
// ExpiresOn: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-15T00:00:00Z"); return t}()),
// LastComplianceStateChangeAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-15T18:52:27Z"); return t}()),
// Metadata: map[string]any{
// "departmentId": "NYC-MARKETING-1",
// },
// Owner: to.Ptr("55a32e28-3aa5-4eea-9b5a-4cd85153b966"),
// PolicyAssignmentID: to.Ptr("/subscriptions/35ee058e-5fa0-414c-8145-3ebb8d09b6e2/providers/microsoft.authorization/policyassignments/b101830944f246d8a14088c5"),
// PolicyDefinitionReferenceID: to.Ptr("0b158b46-ff42-4799-8e39-08a5c23b4551"),
// ProvisioningState: to.Ptr("Succeeded"),
// },
// SystemData: &armpolicyinsights.SystemData{
// CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-15T18:52:27Z"); return t}()),
// CreatedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// CreatedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-15T18:52:27Z"); return t}()),
// LastModifiedBy: to.Ptr("b69a9388-9488-4534-b470-7ec6d41beef6"),
// LastModifiedByType: to.Ptr(armpolicyinsights.CreatedByTypeUser),
// },
// }
}