From 73ed42b6d58a7046a362e7204641d9a011d0fbfe Mon Sep 17 00:00:00 2001 From: kt Date: Wed, 24 May 2023 16:35:49 -0700 Subject: [PATCH 1/3] policy.guestconfigurationassignments: migrate to pandora --- internal/clients/client.go | 4 +- internal/services/policy/client/client.go | 21 +- ...irtual_machine_configuration_assignment.go | 131 -------- ...l_machine_configuration_assignment_test.go | 264 --------------- ...ne_configuration_assignment_data_source.go | 53 ++- ...chine_configuration_assignment_resource.go | 90 ++--- ..._configuration_assignment_resource_test.go | 12 +- internal/services/policy/resourceids.go | 1 - ...ual_machine_configuration_assignment_id.go | 23 -- ...achine_configuration_assignment_id_test.go | 88 ----- .../guestconfigurationassignments/README.md | 121 +++++++ .../guestconfigurationassignments/client.go | 26 ++ .../constants.go | 312 ++++++++++++++++++ ..._providers2guestconfigurationassignment.go | 142 ++++++++ .../id_virtualmachine.go | 127 +++++++ .../method_createorupdate.go | 56 ++++ .../method_delete.go | 46 +++ .../method_get.go | 51 +++ .../method_list.go | 52 +++ .../method_rglist.go | 54 +++ .../method_subscriptionlist.go | 54 +++ .../model_assignmentinfo.go | 9 + .../model_assignmentreport.go | 46 +++ .../model_assignmentreportresource.go | 11 + ...ssignmentreportresourcecompliancereason.go | 9 + .../model_configurationinfo.go | 9 + .../model_configurationparameter.go | 9 + .../model_configurationsetting.go | 13 + .../model_guestconfigurationassignment.go | 12 + .../model_guestconfigurationassignmentlist.go | 8 + ..._guestconfigurationassignmentproperties.go | 37 +++ .../model_guestconfigurationnavigation.go | 17 + .../model_vminfo.go | 9 + .../model_vmssvminfo.go | 30 ++ .../guestconfigurationassignments/version.go | 12 + vendor/modules.txt | 1 + 36 files changed, 1365 insertions(+), 595 deletions(-) delete mode 100644 internal/services/policy/parse/virtual_machine_configuration_assignment.go delete mode 100644 internal/services/policy/parse/virtual_machine_configuration_assignment_test.go delete mode 100644 internal/services/policy/validate/virtual_machine_configuration_assignment_id.go delete mode 100644 internal/services/policy/validate/virtual_machine_configuration_assignment_id_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_rglist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_subscriptionlist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreport.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresourcecompliancereason.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationparameter.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationsetting.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignment.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentlist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationnavigation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vminfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vmssvminfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/version.go diff --git a/internal/clients/client.go b/internal/clients/client.go index ab538bf8e053..ac4a05b09056 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -415,7 +415,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error } client.NotificationHubs = notificationhub.NewClient(o) client.Orbital = orbital.NewClient(o) - client.Policy = policy.NewClient(o) + if client.Policy, err = policy.NewClient(o); err != nil { + return fmt.Errorf("building clients for Policy: %+v", err) + } if client.Portal, err = portal.NewClient(o); err != nil { return fmt.Errorf("building clients for Portal: %+v", err) } diff --git a/internal/services/policy/client/client.go b/internal/services/policy/client/client.go index e16d9a6066a6..38d51b3aab2f 100644 --- a/internal/services/policy/client/client.go +++ b/internal/services/policy/client/client.go @@ -1,8 +1,10 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration" // nolint: staticcheck - "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy" // nolint: staticcheck + "fmt" + + "github.com/Azure/azure-sdk-for-go/services/preview/resources/mgmt/2021-06-01-preview/policy" // nolint: staticcheck + "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments" "github.com/hashicorp/go-azure-sdk/resource-manager/policyinsights/2021-10-01/remediations" assignments "github.com/hashicorp/go-azure-sdk/resource-manager/resources/2022-06-01/policyassignments" "github.com/hashicorp/terraform-provider-azurerm/internal/common" @@ -14,10 +16,10 @@ type Client struct { ExemptionsClient *policy.ExemptionsClient SetDefinitionsClient *policy.SetDefinitionsClient RemediationsClient *remediations.RemediationsClient - GuestConfigurationAssignmentsClient *guestconfiguration.AssignmentsClient + GuestConfigurationAssignmentsClient *guestconfigurationassignments.GuestConfigurationAssignmentsClient } -func NewClient(o *common.ClientOptions) *Client { +func NewClient(o *common.ClientOptions) (*Client, error) { assignmentsClient := assignments.NewPolicyAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&assignmentsClient.Client, o.ResourceManagerAuthorizer) @@ -33,8 +35,11 @@ func NewClient(o *common.ClientOptions) *Client { remediationsClient := remediations.NewRemediationsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&remediationsClient.Client, o.ResourceManagerAuthorizer) - guestConfigurationAssignmentsClient := guestconfiguration.NewAssignmentsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) - o.ConfigureClient(&guestConfigurationAssignmentsClient.Client, o.ResourceManagerAuthorizer) + guestConfigurationAssignmentsClient, err := guestconfigurationassignments.NewGuestConfigurationAssignmentsClientWithBaseURI(o.Environment.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building Guest Configuration Assignments Client client: %+v", err) + } + o.Configure(guestConfigurationAssignmentsClient.Client, o.Authorizers.ResourceManager) return &Client{ AssignmentsClient: &assignmentsClient, @@ -42,6 +47,6 @@ func NewClient(o *common.ClientOptions) *Client { ExemptionsClient: &exemptionsClient, SetDefinitionsClient: &setDefinitionsClient, RemediationsClient: &remediationsClient, - GuestConfigurationAssignmentsClient: &guestConfigurationAssignmentsClient, - } + GuestConfigurationAssignmentsClient: guestConfigurationAssignmentsClient, + }, nil } diff --git a/internal/services/policy/parse/virtual_machine_configuration_assignment.go b/internal/services/policy/parse/virtual_machine_configuration_assignment.go deleted file mode 100644 index c928e2eab61e..000000000000 --- a/internal/services/policy/parse/virtual_machine_configuration_assignment.go +++ /dev/null @@ -1,131 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VirtualMachineConfigurationAssignmentId struct { - SubscriptionId string - ResourceGroup string - VirtualMachineName string - GuestConfigurationAssignmentName string -} - -func NewVirtualMachineConfigurationAssignmentID(subscriptionId, resourceGroup, virtualMachineName, guestConfigurationAssignmentName string) VirtualMachineConfigurationAssignmentId { - return VirtualMachineConfigurationAssignmentId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - VirtualMachineName: virtualMachineName, - GuestConfigurationAssignmentName: guestConfigurationAssignmentName, - } -} - -func (id VirtualMachineConfigurationAssignmentId) String() string { - segments := []string{ - fmt.Sprintf("Guest Configuration Assignment Name %q", id.GuestConfigurationAssignmentName), - fmt.Sprintf("Virtual Machine Name %q", id.VirtualMachineName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Virtual Machine Configuration Assignment", segmentsStr) -} - -func (id VirtualMachineConfigurationAssignmentId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.VirtualMachineName, id.GuestConfigurationAssignmentName) -} - -// VirtualMachineConfigurationAssignmentID parses a VirtualMachineConfigurationAssignment ID into an VirtualMachineConfigurationAssignmentId struct -func VirtualMachineConfigurationAssignmentID(input string) (*VirtualMachineConfigurationAssignmentId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an VirtualMachineConfigurationAssignment ID: %+v", input, err) - } - - resourceId := VirtualMachineConfigurationAssignmentId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.VirtualMachineName, err = id.PopSegment("virtualMachines"); err != nil { - return nil, err - } - if resourceId.GuestConfigurationAssignmentName, err = id.PopSegment("guestConfigurationAssignments"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} - -// VirtualMachineConfigurationAssignmentIDInsensitively parses an VirtualMachineConfigurationAssignment ID into an VirtualMachineConfigurationAssignmentId struct, insensitively -// This should only be used to parse an ID for rewriting, the VirtualMachineConfigurationAssignmentID -// method should be used instead for validation etc. -// -// Whilst this may seem strange, this enables Terraform have consistent casing -// which works around issues in Core, whilst handling broken API responses. -func VirtualMachineConfigurationAssignmentIDInsensitively(input string) (*VirtualMachineConfigurationAssignmentId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VirtualMachineConfigurationAssignmentId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - // find the correct casing for the 'virtualMachines' segment - virtualMachinesKey := "virtualMachines" - for key := range id.Path { - if strings.EqualFold(key, virtualMachinesKey) { - virtualMachinesKey = key - break - } - } - if resourceId.VirtualMachineName, err = id.PopSegment(virtualMachinesKey); err != nil { - return nil, err - } - - // find the correct casing for the 'guestConfigurationAssignments' segment - guestConfigurationAssignmentsKey := "guestConfigurationAssignments" - for key := range id.Path { - if strings.EqualFold(key, guestConfigurationAssignmentsKey) { - guestConfigurationAssignmentsKey = key - break - } - } - if resourceId.GuestConfigurationAssignmentName, err = id.PopSegment(guestConfigurationAssignmentsKey); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/policy/parse/virtual_machine_configuration_assignment_test.go b/internal/services/policy/parse/virtual_machine_configuration_assignment_test.go deleted file mode 100644 index b7cd58f2959f..000000000000 --- a/internal/services/policy/parse/virtual_machine_configuration_assignment_test.go +++ /dev/null @@ -1,264 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = VirtualMachineConfigurationAssignmentId{} - -func TestVirtualMachineConfigurationAssignmentIDFormatter(t *testing.T) { - actual := NewVirtualMachineConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "resGroup1", "vm1", "assignment1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/assignment1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestVirtualMachineConfigurationAssignmentID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VirtualMachineConfigurationAssignmentId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/", - Error: true, - }, - - { - // missing value for VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/", - Error: true, - }, - - { - // missing GuestConfigurationAssignmentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/", - Error: true, - }, - - { - // missing value for GuestConfigurationAssignmentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/assignment1", - Expected: &VirtualMachineConfigurationAssignmentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - VirtualMachineName: "vm1", - GuestConfigurationAssignmentName: "assignment1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.COMPUTE/VIRTUALMACHINES/VM1/PROVIDERS/MICROSOFT.GUESTCONFIGURATION/GUESTCONFIGURATIONASSIGNMENTS/ASSIGNMENT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := VirtualMachineConfigurationAssignmentID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.VirtualMachineName != v.Expected.VirtualMachineName { - t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) - } - if actual.GuestConfigurationAssignmentName != v.Expected.GuestConfigurationAssignmentName { - t.Fatalf("Expected %q but got %q for GuestConfigurationAssignmentName", v.Expected.GuestConfigurationAssignmentName, actual.GuestConfigurationAssignmentName) - } - } -} - -func TestVirtualMachineConfigurationAssignmentIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VirtualMachineConfigurationAssignmentId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/", - Error: true, - }, - - { - // missing value for VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/", - Error: true, - }, - - { - // missing GuestConfigurationAssignmentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/", - Error: true, - }, - - { - // missing value for GuestConfigurationAssignmentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/assignment1", - Expected: &VirtualMachineConfigurationAssignmentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - VirtualMachineName: "vm1", - GuestConfigurationAssignmentName: "assignment1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualmachines/vm1/providers/Microsoft.GuestConfiguration/guestconfigurationassignments/assignment1", - Expected: &VirtualMachineConfigurationAssignmentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - VirtualMachineName: "vm1", - GuestConfigurationAssignmentName: "assignment1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/VIRTUALMACHINES/vm1/providers/Microsoft.GuestConfiguration/GUESTCONFIGURATIONASSIGNMENTS/assignment1", - Expected: &VirtualMachineConfigurationAssignmentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - VirtualMachineName: "vm1", - GuestConfigurationAssignmentName: "assignment1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/ViRtUaLmAcHiNeS/vm1/providers/Microsoft.GuestConfiguration/GuEsTcOnFiGuRaTiOnAsSiGnMeNtS/assignment1", - Expected: &VirtualMachineConfigurationAssignmentId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - VirtualMachineName: "vm1", - GuestConfigurationAssignmentName: "assignment1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := VirtualMachineConfigurationAssignmentIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.VirtualMachineName != v.Expected.VirtualMachineName { - t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) - } - if actual.GuestConfigurationAssignmentName != v.Expected.GuestConfigurationAssignmentName { - t.Fatalf("Expected %q but got %q for GuestConfigurationAssignmentName", v.Expected.GuestConfigurationAssignmentName, actual.GuestConfigurationAssignmentName) - } - } -} diff --git a/internal/services/policy/policy_virtual_machine_configuration_assignment_data_source.go b/internal/services/policy/policy_virtual_machine_configuration_assignment_data_source.go index 5896e8b3271c..19bab4051434 100644 --- a/internal/services/policy/policy_virtual_machine_configuration_assignment_data_source.go +++ b/internal/services/policy/policy_virtual_machine_configuration_assignment_data_source.go @@ -5,13 +5,13 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourcePolicyVirtualMachineConfigurationAssignment() *pluginsdk.Resource { @@ -78,11 +78,10 @@ func dataSourcePolicyVirtualMachineConfigurationAssignmentRead(d *pluginsdk.Reso vmName := d.Get("virtual_machine_name").(string) name := d.Get("name").(string) - id := parse.NewVirtualMachineConfigurationAssignmentID(subscriptionId, resourceGroup, vmName, name) - - resp, err := client.Get(ctx, id.ResourceGroup, id.GuestConfigurationAssignmentName, id.VirtualMachineName) + id := guestconfigurationassignments.NewProviders2GuestConfigurationAssignmentID(subscriptionId, resourceGroup, vmName, name) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] guestConfiguration %q was not found", id.GuestConfigurationAssignmentName) return nil } @@ -95,37 +94,29 @@ func dataSourcePolicyVirtualMachineConfigurationAssignmentRead(d *pluginsdk.Reso d.Set("resource_group_name", resourceGroup) d.Set("virtual_machine_name", vmName) - if props := resp.Properties; props != nil { - if v := props.AssignmentHash; v != nil { - d.Set("assignment_hash", v) - } - - if v := string(props.ComplianceStatus); v != "" { - d.Set("compliance_status", v) - } - - if v := props.LatestReportID; v != nil { - d.Set("latest_report_id", v) - } + if model := resp.Model; model != nil { + if props := model.Properties; props != nil { - if v := props.LastComplianceStatusChecked; v != nil { - d.Set("last_compliance_status_checked", v.Format(time.RFC3339)) - } + d.Set("assignment_hash", pointer.From(props.AssignmentHash)) + d.Set("compliance_status", string(pointer.From(props.ComplianceStatus))) + d.Set("latest_report_id", pointer.From(props.LatestReportId)) + d.Set("last_compliance_status_checked", pointer.From(props.LastComplianceStatusChecked)) - contentHash, contentUri := dataSourceFlattenGuestConfigurationAssignment(props.GuestConfiguration) + contentHash, contentUri := dataSourceFlattenGuestConfigurationAssignment(props.GuestConfiguration) - if contentHash != nil { - d.Set("content_hash", contentHash) - } + if contentHash != nil { + d.Set("content_hash", contentHash) + } - if contentUri != nil { - d.Set("content_uri", contentUri) + if contentUri != nil { + d.Set("content_uri", contentUri) + } } } return nil } -func dataSourceFlattenGuestConfigurationAssignment(input *guestconfiguration.Navigation) (*string, *string) { +func dataSourceFlattenGuestConfigurationAssignment(input *guestconfigurationassignments.GuestConfigurationNavigation) (*string, *string) { if input == nil { return nil, nil } @@ -135,8 +126,8 @@ func dataSourceFlattenGuestConfigurationAssignment(input *guestconfiguration.Nav contentHash = input.ContentHash } var contentUri *string - if input.ContentURI != nil { - contentUri = input.ContentURI + if input.ContentUri != nil { + contentUri = input.ContentUri } return contentHash, contentUri diff --git a/internal/services/policy/policy_virtual_machine_configuration_assignment_resource.go b/internal/services/policy/policy_virtual_machine_configuration_assignment_resource.go index e871ce42eacb..016a712b0bce 100644 --- a/internal/services/policy/policy_virtual_machine_configuration_assignment_resource.go +++ b/internal/services/policy/policy_virtual_machine_configuration_assignment_resource.go @@ -6,14 +6,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration" // nolint: staticcheck + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" computeParse "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/parse" computeValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/compute/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -35,7 +36,7 @@ func resourcePolicyVirtualMachineConfigurationAssignment() *pluginsdk.Resource { }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VirtualMachineConfigurationAssignmentID(id) + _, err := guestconfigurationassignments.ParseProviders2GuestConfigurationAssignmentID(id) return err }), @@ -71,10 +72,10 @@ func resourcePolicyVirtualMachineConfigurationAssignmentSchema() map[string]*plu Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.StringInSlice([]string{ - string(guestconfiguration.AssignmentTypeAudit), - string(guestconfiguration.AssignmentTypeDeployAndAutoCorrect), - string(guestconfiguration.AssignmentTypeApplyAndAutoCorrect), - string(guestconfiguration.AssignmentTypeApplyAndMonitor), + string(guestconfigurationassignments.AssignmentTypeAudit), + string(guestconfigurationassignments.AssignmentTypeDeployAndAutoCorrect), + string(guestconfigurationassignments.AssignmentTypeApplyAndAutoCorrect), + string(guestconfigurationassignments.AssignmentTypeApplyAndMonitor), }, false), }, @@ -132,24 +133,24 @@ func resourcePolicyVirtualMachineConfigurationAssignmentCreateUpdate(d *pluginsd return err } - id := parse.NewVirtualMachineConfigurationAssignmentID(subscriptionId, vmId.ResourceGroup, vmId.Name, d.Get("name").(string)) + id := guestconfigurationassignments.NewProviders2GuestConfigurationAssignmentID(subscriptionId, vmId.ResourceGroup, vmId.Name, d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.GuestConfigurationAssignmentName, id.VirtualMachineName) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for present of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_policy_virtual_machine_configuration_assignment", id.ID()) } } guestConfiguration := expandGuestConfigurationAssignment(d.Get("configuration").([]interface{}), id.GuestConfigurationAssignmentName) - parameter := guestconfiguration.Assignment{ + assignment := guestconfigurationassignments.GuestConfigurationAssignment{ Name: utils.String(id.GuestConfigurationAssignmentName), Location: utils.String(location.Normalize(d.Get("location").(string))), - Properties: &guestconfiguration.AssignmentProperties{ + Properties: &guestconfigurationassignments.GuestConfigurationAssignmentProperties{ GuestConfiguration: guestConfiguration, }, } @@ -159,14 +160,14 @@ func resourcePolicyVirtualMachineConfigurationAssignmentCreateUpdate(d *pluginsd // contentURI to see if it is on a service team owned storage account or not // all built-in guest configuration will always be on a service team owned // storage account - if guestConfiguration.ContentURI != nil || *guestConfiguration.ContentURI != "" { - if strings.Contains(strings.ToLower(*guestConfiguration.ContentURI), "oaasguestconfig") { - parameter.Properties.GuestConfiguration.ContentHash = nil - parameter.Properties.GuestConfiguration.ContentURI = nil + if guestConfiguration.ContentUri != nil || *guestConfiguration.ContentUri != "" { + if strings.Contains(strings.ToLower(*guestConfiguration.ContentUri), "oaasguestconfig") { + assignment.Properties.GuestConfiguration.ContentHash = nil + assignment.Properties.GuestConfiguration.ContentUri = nil } } - if _, err := client.CreateOrUpdate(ctx, id.GuestConfigurationAssignmentName, parameter, id.ResourceGroup, id.VirtualMachineName); err != nil { + if _, err := client.CreateOrUpdate(ctx, id, assignment); err != nil { return fmt.Errorf("creating/updating %s: %+v", id, err) } @@ -181,29 +182,32 @@ func resourcePolicyVirtualMachineConfigurationAssignmentRead(d *pluginsdk.Resour ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VirtualMachineConfigurationAssignmentID(d.Id()) + id, err := guestconfigurationassignments.ParseProviders2GuestConfigurationAssignmentID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.GuestConfigurationAssignmentName, id.VirtualMachineName) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { - log.Printf("[INFO] guestConfiguration %q does not exist - removing from state", d.Id()) + if response.WasNotFound(resp.HttpResponse) { + log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil } return fmt.Errorf("retrieving %s: %+v", id, err) } - vmId := computeParse.NewVirtualMachineID(subscriptionId, id.ResourceGroup, id.VirtualMachineName) + vmId := computeParse.NewVirtualMachineID(subscriptionId, id.ResourceGroupName, id.VirtualMachineName) d.Set("name", id.GuestConfigurationAssignmentName) d.Set("virtual_machine_id", vmId.ID()) - d.Set("location", location.NormalizeNilable(resp.Location)) - if props := resp.Properties; props != nil { - if err := d.Set("configuration", flattenGuestConfigurationAssignment(props.GuestConfiguration)); err != nil { - return fmt.Errorf("setting `configuration`: %+v", err) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(model.Location)) + + if props := model.Properties; props != nil { + if err := d.Set("configuration", flattenGuestConfigurationAssignment(props.GuestConfiguration)); err != nil { + return fmt.Errorf("setting `configuration`: %+v", err) + } } } return nil @@ -214,32 +218,32 @@ func resourcePolicyVirtualMachineConfigurationAssignmentDelete(d *pluginsdk.Reso ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VirtualMachineConfigurationAssignmentID(d.Id()) + id, err := guestconfigurationassignments.ParseProviders2GuestConfigurationAssignmentID(d.Id()) if err != nil { return err } - if _, err := client.Delete(ctx, id.ResourceGroup, id.GuestConfigurationAssignmentName, id.VirtualMachineName); err != nil { + if _, err := client.Delete(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", id, err) } return nil } -func expandGuestConfigurationAssignment(input []interface{}, name string) *guestconfiguration.Navigation { +func expandGuestConfigurationAssignment(input []interface{}, name string) *guestconfigurationassignments.GuestConfigurationNavigation { if len(input) == 0 { return nil } v := input[0].(map[string]interface{}) - result := guestconfiguration.Navigation{ + result := guestconfigurationassignments.GuestConfigurationNavigation{ Name: utils.String(name), Version: utils.String(v["version"].(string)), ConfigurationParameter: expandGuestConfigurationAssignmentConfigurationParameters(v["parameter"].(*pluginsdk.Set).List()), } if v, ok := v["assignment_type"]; ok { - result.AssignmentType = guestconfiguration.AssignmentType(v.(string)) + result.AssignmentType = pointer.To(guestconfigurationassignments.AssignmentType(v.(string))) } if v, ok := v["content_hash"]; ok { @@ -247,17 +251,17 @@ func expandGuestConfigurationAssignment(input []interface{}, name string) *guest } if v, ok := v["content_uri"]; ok { - result.ContentURI = utils.String(v.(string)) + result.ContentUri = utils.String(v.(string)) } return &result } -func expandGuestConfigurationAssignmentConfigurationParameters(input []interface{}) *[]guestconfiguration.ConfigurationParameter { - results := make([]guestconfiguration.ConfigurationParameter, 0) +func expandGuestConfigurationAssignmentConfigurationParameters(input []interface{}) *[]guestconfigurationassignments.ConfigurationParameter { + results := make([]guestconfigurationassignments.ConfigurationParameter, 0) for _, item := range input { v := item.(map[string]interface{}) - results = append(results, guestconfiguration.ConfigurationParameter{ + results = append(results, guestconfigurationassignments.ConfigurationParameter{ Name: utils.String(v["name"].(string)), Value: utils.String(v["value"].(string)), }) @@ -265,7 +269,7 @@ func expandGuestConfigurationAssignmentConfigurationParameters(input []interface return &results } -func flattenGuestConfigurationAssignment(input *guestconfiguration.Navigation) []interface{} { +func flattenGuestConfigurationAssignment(input *guestconfigurationassignments.GuestConfigurationNavigation) []interface{} { if input == nil { return make([]interface{}, 0) } @@ -274,17 +278,17 @@ func flattenGuestConfigurationAssignment(input *guestconfiguration.Navigation) [ if input.Version != nil { version = *input.Version } - var assignmentType guestconfiguration.AssignmentType - if input.AssignmentType != "" { - assignmentType = input.AssignmentType + var assignmentType guestconfigurationassignments.AssignmentType + if input.AssignmentType != nil { + assignmentType = *input.AssignmentType } var contentHash string if input.ContentHash != nil { contentHash = *input.ContentHash } var contentUri string - if input.ContentURI != nil { - contentUri = *input.ContentURI + if input.ContentUri != nil { + contentUri = *input.ContentUri } return []interface{}{ map[string]interface{}{ @@ -297,7 +301,7 @@ func flattenGuestConfigurationAssignment(input *guestconfiguration.Navigation) [ } } -func flattenGuestConfigurationAssignmentConfigurationParameters(input *[]guestconfiguration.ConfigurationParameter) []interface{} { +func flattenGuestConfigurationAssignmentConfigurationParameters(input *[]guestconfigurationassignments.ConfigurationParameter) []interface{} { results := make([]interface{}, 0) if input == nil { return results diff --git a/internal/services/policy/policy_virtual_machine_configuration_assignment_resource_test.go b/internal/services/policy/policy_virtual_machine_configuration_assignment_resource_test.go index a1145a2016fb..f9fb7fd12923 100644 --- a/internal/services/policy/policy_virtual_machine_configuration_assignment_resource_test.go +++ b/internal/services/policy/policy_virtual_machine_configuration_assignment_resource_test.go @@ -6,10 +6,12 @@ import ( "strings" "testing" + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -69,18 +71,18 @@ func TestAccPolicyVirtualMachineConfigurationAssignment_update(t *testing.T) { } func (r PolicyVirtualMachineConfigurationAssignmentResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.VirtualMachineConfigurationAssignmentID(state.ID) + id, err := guestconfigurationassignments.ParseProviders2GuestConfigurationAssignmentID(state.ID) if err != nil { return nil, err } - resp, err := client.Policy.GuestConfigurationAssignmentsClient.Get(ctx, id.ResourceGroup, id.GuestConfigurationAssignmentName, id.VirtualMachineName) + resp, err := client.Policy.GuestConfigurationAssignmentsClient.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return utils.Bool(false), nil } return nil, fmt.Errorf("retrieving %s: %+v", id, err) } - return utils.Bool(resp.Properties != nil), nil + return pointer.To(resp.Model != nil), nil } func (r PolicyVirtualMachineConfigurationAssignmentResource) templateBase(data acceptance.TestData) string { diff --git a/internal/services/policy/resourceids.go b/internal/services/policy/resourceids.go index 581f3b15fed6..4de89a075b3f 100644 --- a/internal/services/policy/resourceids.go +++ b/internal/services/policy/resourceids.go @@ -2,7 +2,6 @@ package policy //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ResourceGroupAssignment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Authorization/policyAssignments/assignment1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SubscriptionAssignment -id=/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Authorization/policyAssignments/assignment1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=VirtualMachineConfigurationAssignment -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/assignment1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ResourceGroupPolicyRemediation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.PolicyInsights/remediations/remediation1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SubscriptionPolicyRemediation -id=/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.PolicyInsights/remediations/remediation1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=ResourceGroupPolicyExemption -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Authorization/policyExemptions/exemption1 diff --git a/internal/services/policy/validate/virtual_machine_configuration_assignment_id.go b/internal/services/policy/validate/virtual_machine_configuration_assignment_id.go deleted file mode 100644 index 57636ac60b8a..000000000000 --- a/internal/services/policy/validate/virtual_machine_configuration_assignment_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/policy/parse" -) - -func VirtualMachineConfigurationAssignmentID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VirtualMachineConfigurationAssignmentID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/policy/validate/virtual_machine_configuration_assignment_id_test.go b/internal/services/policy/validate/virtual_machine_configuration_assignment_id_test.go deleted file mode 100644 index 843118531a3c..000000000000 --- a/internal/services/policy/validate/virtual_machine_configuration_assignment_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestVirtualMachineConfigurationAssignmentID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/", - Valid: false, - }, - - { - // missing value for VirtualMachineName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/", - Valid: false, - }, - - { - // missing GuestConfigurationAssignmentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/", - Valid: false, - }, - - { - // missing value for GuestConfigurationAssignmentName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/assignment1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.COMPUTE/VIRTUALMACHINES/VM1/PROVIDERS/MICROSOFT.GUESTCONFIGURATION/GUESTCONFIGURATIONASSIGNMENTS/ASSIGNMENT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := VirtualMachineConfigurationAssignmentID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/README.md new file mode 100644 index 000000000000..fc92714bb1e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/README.md @@ -0,0 +1,121 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments` Documentation + +The `guestconfigurationassignments` SDK allows for interaction with the Azure Resource Manager Service `guestconfiguration` (API Version `2020-06-25`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments" +``` + + +### Client Initialization + +```go +client := guestconfigurationassignments.NewGuestConfigurationAssignmentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `GuestConfigurationAssignmentsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := guestconfigurationassignments.NewProviders2GuestConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineValue", "guestConfigurationAssignmentValue") + +payload := guestconfigurationassignments.GuestConfigurationAssignment{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GuestConfigurationAssignmentsClient.Delete` + +```go +ctx := context.TODO() +id := guestconfigurationassignments.NewProviders2GuestConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineValue", "guestConfigurationAssignmentValue") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GuestConfigurationAssignmentsClient.Get` + +```go +ctx := context.TODO() +id := guestconfigurationassignments.NewProviders2GuestConfigurationAssignmentID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineValue", "guestConfigurationAssignmentValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GuestConfigurationAssignmentsClient.List` + +```go +ctx := context.TODO() +id := guestconfigurationassignments.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GuestConfigurationAssignmentsClient.RGList` + +```go +ctx := context.TODO() +id := guestconfigurationassignments.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +read, err := client.RGList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `GuestConfigurationAssignmentsClient.SubscriptionList` + +```go +ctx := context.TODO() +id := guestconfigurationassignments.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +read, err := client.SubscriptionList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go new file mode 100644 index 000000000000..4ac5b5d34ddf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/client.go @@ -0,0 +1,26 @@ +package guestconfigurationassignments + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestConfigurationAssignmentsClient struct { + Client *resourcemanager.Client +} + +func NewGuestConfigurationAssignmentsClientWithBaseURI(api environments.Api) (*GuestConfigurationAssignmentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(api, "guestconfigurationassignments", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating GuestConfigurationAssignmentsClient: %+v", err) + } + + return &GuestConfigurationAssignmentsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/constants.go new file mode 100644 index 000000000000..d2e2c9c3c39b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/constants.go @@ -0,0 +1,312 @@ +package guestconfigurationassignments + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActionAfterReboot string + +const ( + ActionAfterRebootContinueConfiguration ActionAfterReboot = "ContinueConfiguration" + ActionAfterRebootStopConfiguration ActionAfterReboot = "StopConfiguration" +) + +func PossibleValuesForActionAfterReboot() []string { + return []string{ + string(ActionAfterRebootContinueConfiguration), + string(ActionAfterRebootStopConfiguration), + } +} + +func (s *ActionAfterReboot) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseActionAfterReboot(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseActionAfterReboot(input string) (*ActionAfterReboot, error) { + vals := map[string]ActionAfterReboot{ + "continueconfiguration": ActionAfterRebootContinueConfiguration, + "stopconfiguration": ActionAfterRebootStopConfiguration, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActionAfterReboot(input) + return &out, nil +} + +type AssignmentType string + +const ( + AssignmentTypeApplyAndAutoCorrect AssignmentType = "ApplyAndAutoCorrect" + AssignmentTypeApplyAndMonitor AssignmentType = "ApplyAndMonitor" + AssignmentTypeAudit AssignmentType = "Audit" + AssignmentTypeDeployAndAutoCorrect AssignmentType = "DeployAndAutoCorrect" +) + +func PossibleValuesForAssignmentType() []string { + return []string{ + string(AssignmentTypeApplyAndAutoCorrect), + string(AssignmentTypeApplyAndMonitor), + string(AssignmentTypeAudit), + string(AssignmentTypeDeployAndAutoCorrect), + } +} + +func (s *AssignmentType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAssignmentType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAssignmentType(input string) (*AssignmentType, error) { + vals := map[string]AssignmentType{ + "applyandautocorrect": AssignmentTypeApplyAndAutoCorrect, + "applyandmonitor": AssignmentTypeApplyAndMonitor, + "audit": AssignmentTypeAudit, + "deployandautocorrect": AssignmentTypeDeployAndAutoCorrect, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AssignmentType(input) + return &out, nil +} + +type ComplianceStatus string + +const ( + ComplianceStatusCompliant ComplianceStatus = "Compliant" + ComplianceStatusNonCompliant ComplianceStatus = "NonCompliant" + ComplianceStatusPending ComplianceStatus = "Pending" +) + +func PossibleValuesForComplianceStatus() []string { + return []string{ + string(ComplianceStatusCompliant), + string(ComplianceStatusNonCompliant), + string(ComplianceStatusPending), + } +} + +func (s *ComplianceStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComplianceStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComplianceStatus(input string) (*ComplianceStatus, error) { + vals := map[string]ComplianceStatus{ + "compliant": ComplianceStatusCompliant, + "noncompliant": ComplianceStatusNonCompliant, + "pending": ComplianceStatusPending, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComplianceStatus(input) + return &out, nil +} + +type ConfigurationMode string + +const ( + ConfigurationModeApplyAndAutoCorrect ConfigurationMode = "ApplyAndAutoCorrect" + ConfigurationModeApplyAndMonitor ConfigurationMode = "ApplyAndMonitor" + ConfigurationModeApplyOnly ConfigurationMode = "ApplyOnly" +) + +func PossibleValuesForConfigurationMode() []string { + return []string{ + string(ConfigurationModeApplyAndAutoCorrect), + string(ConfigurationModeApplyAndMonitor), + string(ConfigurationModeApplyOnly), + } +} + +func (s *ConfigurationMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConfigurationMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConfigurationMode(input string) (*ConfigurationMode, error) { + vals := map[string]ConfigurationMode{ + "applyandautocorrect": ConfigurationModeApplyAndAutoCorrect, + "applyandmonitor": ConfigurationModeApplyAndMonitor, + "applyonly": ConfigurationModeApplyOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConfigurationMode(input) + return &out, nil +} + +type Kind string + +const ( + KindDSC Kind = "DSC" +) + +func PossibleValuesForKind() []string { + return []string{ + string(KindDSC), + } +} + +func (s *Kind) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseKind(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseKind(input string) (*Kind, error) { + vals := map[string]Kind{ + "dsc": KindDSC, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Kind(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateFailed), + string(ProvisioningStateSucceeded), + } +} + +func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningState(input string) (*ProvisioningState, error) { + vals := map[string]ProvisioningState{ + "canceled": ProvisioningStateCanceled, + "created": ProvisioningStateCreated, + "failed": ProvisioningStateFailed, + "succeeded": ProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningState(input) + return &out, nil +} + +type Type string + +const ( + TypeConsistency Type = "Consistency" + TypeInitial Type = "Initial" +) + +func PossibleValuesForType() []string { + return []string{ + string(TypeConsistency), + string(TypeInitial), + } +} + +func (s *Type) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseType(input string) (*Type, error) { + vals := map[string]Type{ + "consistency": TypeConsistency, + "initial": TypeInitial, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Type(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go new file mode 100644 index 000000000000..a7c5aeee3550 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_providers2guestconfigurationassignment.go @@ -0,0 +1,142 @@ +package guestconfigurationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = Providers2GuestConfigurationAssignmentId{} + +// Providers2GuestConfigurationAssignmentId is a struct representing the Resource ID for a Providers 2 Guest Configuration Assignment +type Providers2GuestConfigurationAssignmentId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string + GuestConfigurationAssignmentName string +} + +// NewProviders2GuestConfigurationAssignmentID returns a new Providers2GuestConfigurationAssignmentId struct +func NewProviders2GuestConfigurationAssignmentID(subscriptionId string, resourceGroupName string, virtualMachineName string, guestConfigurationAssignmentName string) Providers2GuestConfigurationAssignmentId { + return Providers2GuestConfigurationAssignmentId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + GuestConfigurationAssignmentName: guestConfigurationAssignmentName, + } +} + +// ParseProviders2GuestConfigurationAssignmentID parses 'input' into a Providers2GuestConfigurationAssignmentId +func ParseProviders2GuestConfigurationAssignmentID(input string) (*Providers2GuestConfigurationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(Providers2GuestConfigurationAssignmentId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Providers2GuestConfigurationAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + } + + if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + } + + return &id, nil +} + +// ParseProviders2GuestConfigurationAssignmentIDInsensitively parses 'input' case-insensitively into a Providers2GuestConfigurationAssignmentId +// note: this method should only be used for API response data and not user input +func ParseProviders2GuestConfigurationAssignmentIDInsensitively(input string) (*Providers2GuestConfigurationAssignmentId, error) { + parser := resourceids.NewParserFromResourceIdType(Providers2GuestConfigurationAssignmentId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := Providers2GuestConfigurationAssignmentId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + } + + if id.GuestConfigurationAssignmentName, ok = parsed.Parsed["guestConfigurationAssignmentName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "guestConfigurationAssignmentName", *parsed) + } + + return &id, nil +} + +// ValidateProviders2GuestConfigurationAssignmentID checks that 'input' can be parsed as a Providers 2 Guest Configuration Assignment ID +func ValidateProviders2GuestConfigurationAssignmentID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseProviders2GuestConfigurationAssignmentID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Providers 2 Guest Configuration Assignment ID +func (id Providers2GuestConfigurationAssignmentId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName, id.GuestConfigurationAssignmentName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Providers 2 Guest Configuration Assignment ID +func (id Providers2GuestConfigurationAssignmentId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineValue"), + resourceids.StaticSegment("staticProviders2", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftGuestConfiguration", "Microsoft.GuestConfiguration", "Microsoft.GuestConfiguration"), + resourceids.StaticSegment("staticGuestConfigurationAssignments", "guestConfigurationAssignments", "guestConfigurationAssignments"), + resourceids.UserSpecifiedSegment("guestConfigurationAssignmentName", "guestConfigurationAssignmentValue"), + } +} + +// String returns a human-readable description of this Providers 2 Guest Configuration Assignment ID +func (id Providers2GuestConfigurationAssignmentId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + fmt.Sprintf("Guest Configuration Assignment Name: %q", id.GuestConfigurationAssignmentName), + } + return fmt.Sprintf("Providers 2 Guest Configuration Assignment (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go new file mode 100644 index 000000000000..22608a73d066 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/id_virtualmachine.go @@ -0,0 +1,127 @@ +package guestconfigurationassignments + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualMachineName, ok = parsed.Parsed["virtualMachineName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", *parsed) + } + + return &id, nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineValue"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_createorupdate.go new file mode 100644 index 000000000000..cac265a8ddaf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_createorupdate.go @@ -0,0 +1,56 @@ +package guestconfigurationassignments + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GuestConfigurationAssignment +} + +// CreateOrUpdate ... +func (c GuestConfigurationAssignmentsClient) CreateOrUpdate(ctx context.Context, id Providers2GuestConfigurationAssignmentId, input GuestConfigurationAssignment) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_delete.go new file mode 100644 index 000000000000..3e9d3aa9d005 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_delete.go @@ -0,0 +1,46 @@ +package guestconfigurationassignments + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c GuestConfigurationAssignmentsClient) Delete(ctx context.Context, id Providers2GuestConfigurationAssignmentId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_get.go new file mode 100644 index 000000000000..82158d5e165b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_get.go @@ -0,0 +1,51 @@ +package guestconfigurationassignments + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GuestConfigurationAssignment +} + +// Get ... +func (c GuestConfigurationAssignmentsClient) Get(ctx context.Context, id Providers2GuestConfigurationAssignmentId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_list.go new file mode 100644 index 000000000000..aa04d7e7f43f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_list.go @@ -0,0 +1,52 @@ +package guestconfigurationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GuestConfigurationAssignmentList +} + +// List ... +func (c GuestConfigurationAssignmentsClient) List(ctx context.Context, id VirtualMachineId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_rglist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_rglist.go new file mode 100644 index 000000000000..a841bf952dfe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_rglist.go @@ -0,0 +1,54 @@ +package guestconfigurationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RGListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GuestConfigurationAssignmentList +} + +// RGList ... +func (c GuestConfigurationAssignmentsClient) RGList(ctx context.Context, id commonids.ResourceGroupId) (result RGListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_subscriptionlist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_subscriptionlist.go new file mode 100644 index 000000000000..340d8f183b4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/method_subscriptionlist.go @@ -0,0 +1,54 @@ +package guestconfigurationassignments + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubscriptionListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *GuestConfigurationAssignmentList +} + +// SubscriptionList ... +func (c GuestConfigurationAssignmentsClient) SubscriptionList(ctx context.Context, id commonids.SubscriptionId) (result SubscriptionListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentinfo.go new file mode 100644 index 000000000000..f9816e80055c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentinfo.go @@ -0,0 +1,9 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssignmentInfo struct { + Configuration *ConfigurationInfo `json:"configuration,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreport.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreport.go new file mode 100644 index 000000000000..a20e029268f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreport.go @@ -0,0 +1,46 @@ +package guestconfigurationassignments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssignmentReport struct { + Assignment *AssignmentInfo `json:"assignment,omitempty"` + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` + EndTime *string `json:"endTime,omitempty"` + Id *string `json:"id,omitempty"` + OperationType *Type `json:"operationType,omitempty"` + ReportId *string `json:"reportId,omitempty"` + Resources *[]AssignmentReportResource `json:"resources,omitempty"` + StartTime *string `json:"startTime,omitempty"` + VM *VMInfo `json:"vm,omitempty"` +} + +func (o *AssignmentReport) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AssignmentReport) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *AssignmentReport) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AssignmentReport) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresource.go new file mode 100644 index 000000000000..ee4b722cc824 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresource.go @@ -0,0 +1,11 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssignmentReportResource struct { + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` + Properties *interface{} `json:"properties,omitempty"` + Reasons *[]AssignmentReportResourceComplianceReason `json:"reasons,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresourcecompliancereason.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresourcecompliancereason.go new file mode 100644 index 000000000000..167c1a5c53f5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_assignmentreportresourcecompliancereason.go @@ -0,0 +1,9 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AssignmentReportResourceComplianceReason struct { + Code *string `json:"code,omitempty"` + Phrase *string `json:"phrase,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationinfo.go new file mode 100644 index 000000000000..b5620a54591b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationinfo.go @@ -0,0 +1,9 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationInfo struct { + Name *string `json:"name,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationparameter.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationparameter.go new file mode 100644 index 000000000000..ec2c9d62dd57 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationparameter.go @@ -0,0 +1,9 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationParameter struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationsetting.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationsetting.go new file mode 100644 index 000000000000..befd6e45b019 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_configurationsetting.go @@ -0,0 +1,13 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConfigurationSetting struct { + ActionAfterReboot *ActionAfterReboot `json:"actionAfterReboot,omitempty"` + AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` + ConfigurationMode *ConfigurationMode `json:"configurationMode,omitempty"` + ConfigurationModeFrequencyMins *float64 `json:"configurationModeFrequencyMins,omitempty"` + RebootIfNeeded *bool `json:"rebootIfNeeded,omitempty"` + RefreshFrequencyMins *float64 `json:"refreshFrequencyMins,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignment.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignment.go new file mode 100644 index 000000000000..922537258087 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignment.go @@ -0,0 +1,12 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestConfigurationAssignment struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *GuestConfigurationAssignmentProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentlist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentlist.go new file mode 100644 index 000000000000..eddf999062b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentlist.go @@ -0,0 +1,8 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestConfigurationAssignmentList struct { + Value *[]GuestConfigurationAssignment `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentproperties.go new file mode 100644 index 000000000000..990191ac2755 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationassignmentproperties.go @@ -0,0 +1,37 @@ +package guestconfigurationassignments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestConfigurationAssignmentProperties struct { + AssignmentHash *string `json:"assignmentHash,omitempty"` + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` + Context *string `json:"context,omitempty"` + GuestConfiguration *GuestConfigurationNavigation `json:"guestConfiguration,omitempty"` + LastComplianceStatusChecked *string `json:"lastComplianceStatusChecked,omitempty"` + LatestAssignmentReport *AssignmentReport `json:"latestAssignmentReport,omitempty"` + LatestReportId *string `json:"latestReportId,omitempty"` + ParameterHash *string `json:"parameterHash,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + TargetResourceId *string `json:"targetResourceId,omitempty"` + VMSSVMList *[]VMSSVMInfo `json:"vmssVMList,omitempty"` +} + +func (o *GuestConfigurationAssignmentProperties) GetLastComplianceStatusCheckedAsTime() (*time.Time, error) { + if o.LastComplianceStatusChecked == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastComplianceStatusChecked, "2006-01-02T15:04:05Z07:00") +} + +func (o *GuestConfigurationAssignmentProperties) SetLastComplianceStatusCheckedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastComplianceStatusChecked = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationnavigation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationnavigation.go new file mode 100644 index 000000000000..80c95ad1040c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_guestconfigurationnavigation.go @@ -0,0 +1,17 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestConfigurationNavigation struct { + AssignmentType *AssignmentType `json:"assignmentType,omitempty"` + ConfigurationParameter *[]ConfigurationParameter `json:"configurationParameter,omitempty"` + ConfigurationProtectedParameter *[]ConfigurationParameter `json:"configurationProtectedParameter,omitempty"` + ConfigurationSetting *ConfigurationSetting `json:"configurationSetting,omitempty"` + ContentHash *string `json:"contentHash,omitempty"` + ContentType *string `json:"contentType,omitempty"` + ContentUri *string `json:"contentUri,omitempty"` + Kind *Kind `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vminfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vminfo.go new file mode 100644 index 000000000000..f1554f565717 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vminfo.go @@ -0,0 +1,9 @@ +package guestconfigurationassignments + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMInfo struct { + Id *string `json:"id,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vmssvminfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vmssvminfo.go new file mode 100644 index 000000000000..52f98e91b472 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/model_vmssvminfo.go @@ -0,0 +1,30 @@ +package guestconfigurationassignments + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSSVMInfo struct { + ComplianceStatus *ComplianceStatus `json:"complianceStatus,omitempty"` + LastComplianceChecked *string `json:"lastComplianceChecked,omitempty"` + LatestReportId *string `json:"latestReportId,omitempty"` + VMId *string `json:"vmId,omitempty"` + VMResourceId *string `json:"vmResourceId,omitempty"` +} + +func (o *VMSSVMInfo) GetLastComplianceCheckedAsTime() (*time.Time, error) { + if o.LastComplianceChecked == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastComplianceChecked, "2006-01-02T15:04:05Z07:00") +} + +func (o *VMSSVMInfo) SetLastComplianceCheckedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastComplianceChecked = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/version.go new file mode 100644 index 000000000000..6c08c30d9828 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments/version.go @@ -0,0 +1,12 @@ +package guestconfigurationassignments + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2020-06-25" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/guestconfigurationassignments/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index ca1940e95aca..71adfd625082 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -340,6 +340,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidre github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-04-01/webapplicationfirewallpolicies github.com/hashicorp/go-azure-sdk/resource-manager/frontdoor/2020-05-01/frontdoors +github.com/hashicorp/go-azure-sdk/resource-manager/guestconfiguration/2020-06-25/guestconfigurationassignments github.com/hashicorp/go-azure-sdk/resource-manager/hardwaresecuritymodules/2021-11-30/dedicatedhsms github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08 github.com/hashicorp/go-azure-sdk/resource-manager/healthbot/2022-08-08/healthbots From e0f73d3afd3f42e05fa70b5d044411ea180a42fd Mon Sep 17 00:00:00 2001 From: kt Date: Wed, 24 May 2023 16:49:14 -0700 Subject: [PATCH 2/3] go mod vendor; go mod tidy --- .../guestconfiguration/CHANGELOG.md | 2 - .../2020-06-25/guestconfiguration/_meta.json | 11 - .../guestconfiguration/assignmentreports.go | 203 ------- .../guestconfiguration/assignments.go | 368 ------------ .../2020-06-25/guestconfiguration/client.go | 43 -- .../2020-06-25/guestconfiguration/enums.go | 122 ---- .../hcrpassignmentreports.go | 203 ------- .../guestconfiguration/hcrpassignments.go | 368 ------------ .../2020-06-25/guestconfiguration/models.go | 523 ------------------ .../guestconfiguration/operations.go | 98 ---- .../2020-06-25/guestconfiguration/version.go | 19 - vendor/modules.txt | 1 - 12 files changed, 1961 deletions(-) delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignmentreports.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/client.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/enums.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignmentreports.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignments.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/operations.go delete mode 100644 vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/version.go diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json deleted file mode 100644 index 67f6047b7424..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "6e95cd4c6086d61bb3de67cf6e4209a7b84efa23", - "readme": "/_/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.md", - "tag": "package-2020-06-25", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-2020-06-25 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignmentreports.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignmentreports.go deleted file mode 100644 index 3517e35e7b26..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignmentreports.go +++ /dev/null @@ -1,203 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AssignmentReportsClient is the guest Configuration Client -type AssignmentReportsClient struct { - BaseClient -} - -// NewAssignmentReportsClient creates an instance of the AssignmentReportsClient client. -func NewAssignmentReportsClient(subscriptionID string) AssignmentReportsClient { - return NewAssignmentReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAssignmentReportsClientWithBaseURI creates an instance of the AssignmentReportsClient client using a custom -// endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure -// stack). -func NewAssignmentReportsClientWithBaseURI(baseURI string, subscriptionID string) AssignmentReportsClient { - return AssignmentReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a report for the guest configuration assignment, by reportId. -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - the guest configuration assignment name. -// reportID - the GUID for the guest configuration assignment report. -// VMName - the name of the virtual machine. -func (client AssignmentReportsClient) Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, reportID string, VMName string) (result AssignmentReportType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentReportsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.AssignmentReportsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, reportID, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AssignmentReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, reportID string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentReportsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AssignmentReportsClient) GetResponder(resp *http.Response) (result AssignmentReportType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all reports for the guest configuration assignment, latest report first. -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - the guest configuration assignment name. -// VMName - the name of the virtual machine. -func (client AssignmentReportsClient) List(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result AssignmentReportList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentReportsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.AssignmentReportsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AssignmentReportsClient) ListPreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentReportsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AssignmentReportsClient) ListResponder(resp *http.Response) (result AssignmentReportList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go deleted file mode 100644 index 77b15705e904..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go +++ /dev/null @@ -1,368 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AssignmentsClient is the guest Configuration Client -type AssignmentsClient struct { - BaseClient -} - -// NewAssignmentsClient creates an instance of the AssignmentsClient client. -func NewAssignmentsClient(subscriptionID string) AssignmentsClient { - return NewAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAssignmentsClientWithBaseURI creates an instance of the AssignmentsClient client using a custom endpoint. Use -// this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) AssignmentsClient { - return AssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates an association between a VM and guest configuration -// Parameters: -// guestConfigurationAssignmentName - name of the guest configuration assignment. -// parameters - parameters supplied to the create or update guest configuration assignment. -// resourceGroupName - the resource group name. -// VMName - the name of the virtual machine. -func (client AssignmentsClient) CreateOrUpdate(ctx context.Context, guestConfigurationAssignmentName string, parameters Assignment, resourceGroupName string, VMName string) (result Assignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.AssignmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, guestConfigurationAssignmentName, parameters, resourceGroupName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, guestConfigurationAssignmentName string, parameters Assignment, resourceGroupName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a guest configuration assignment -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - name of the guest configuration assignment -// VMName - the name of the virtual machine. -func (client AssignmentsClient) Delete(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.AssignmentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get information about a guest configuration assignment -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - the guest configuration assignment name. -// VMName - the name of the virtual machine. -func (client AssignmentsClient) Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result Assignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.AssignmentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) GetResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all guest configuration assignments for a virtual machine. -// Parameters: -// resourceGroupName - the resource group name. -// VMName - the name of the virtual machine. -func (client AssignmentsClient) List(ctx context.Context, resourceGroupName string, VMName string) (result AssignmentList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.AssignmentsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, VMName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AssignmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, VMName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "vmName": autorest.Encode("path", VMName), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AssignmentsClient) ListResponder(resp *http.Response) (result AssignmentList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/client.go deleted file mode 100644 index 6741c361440b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/client.go +++ /dev/null @@ -1,43 +0,0 @@ -// Deprecated: Please note, this package has been deprecated. A replacement package is available [github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/guestconfiguration/armguestconfiguration). We strongly encourage you to upgrade to continue receiving updates. See [Migration Guide](https://aka.ms/azsdk/golang/t2/migration) for guidance on upgrading. Refer to our [deprecation policy](https://azure.github.io/azure-sdk/policies_support.html) for more details. -// -// Package guestconfiguration implements the Azure ARM Guestconfiguration service API version 2020-06-25. -// -// Guest Configuration Client -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/Azure/go-autorest/autorest" -) - -const ( - // DefaultBaseURI is the default URI used for the service Guestconfiguration - DefaultBaseURI = "https://management.azure.com" -) - -// BaseClient is the base client for Guestconfiguration. -type BaseClient struct { - autorest.Client - BaseURI string - SubscriptionID string -} - -// New creates an instance of the BaseClient client. -func New(subscriptionID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewWithBaseURI creates an instance of the BaseClient client using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { - return BaseClient{ - Client: autorest.NewClientWithUserAgent(UserAgent()), - BaseURI: baseURI, - SubscriptionID: subscriptionID, - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/enums.go deleted file mode 100644 index 4c0643909c36..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/enums.go +++ /dev/null @@ -1,122 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActionAfterReboot enumerates the values for action after reboot. -type ActionAfterReboot string - -const ( - // ActionAfterRebootContinueConfiguration ... - ActionAfterRebootContinueConfiguration ActionAfterReboot = "ContinueConfiguration" - // ActionAfterRebootStopConfiguration ... - ActionAfterRebootStopConfiguration ActionAfterReboot = "StopConfiguration" -) - -// PossibleActionAfterRebootValues returns an array of possible values for the ActionAfterReboot const type. -func PossibleActionAfterRebootValues() []ActionAfterReboot { - return []ActionAfterReboot{ActionAfterRebootContinueConfiguration, ActionAfterRebootStopConfiguration} -} - -// AssignmentType enumerates the values for assignment type. -type AssignmentType string - -const ( - // AssignmentTypeApplyAndAutoCorrect ... - AssignmentTypeApplyAndAutoCorrect AssignmentType = "ApplyAndAutoCorrect" - // AssignmentTypeApplyAndMonitor ... - AssignmentTypeApplyAndMonitor AssignmentType = "ApplyAndMonitor" - // AssignmentTypeAudit ... - AssignmentTypeAudit AssignmentType = "Audit" - // AssignmentTypeDeployAndAutoCorrect ... - AssignmentTypeDeployAndAutoCorrect AssignmentType = "DeployAndAutoCorrect" -) - -// PossibleAssignmentTypeValues returns an array of possible values for the AssignmentType const type. -func PossibleAssignmentTypeValues() []AssignmentType { - return []AssignmentType{AssignmentTypeApplyAndAutoCorrect, AssignmentTypeApplyAndMonitor, AssignmentTypeAudit, AssignmentTypeDeployAndAutoCorrect} -} - -// ComplianceStatus enumerates the values for compliance status. -type ComplianceStatus string - -const ( - // ComplianceStatusCompliant ... - ComplianceStatusCompliant ComplianceStatus = "Compliant" - // ComplianceStatusNonCompliant ... - ComplianceStatusNonCompliant ComplianceStatus = "NonCompliant" - // ComplianceStatusPending ... - ComplianceStatusPending ComplianceStatus = "Pending" -) - -// PossibleComplianceStatusValues returns an array of possible values for the ComplianceStatus const type. -func PossibleComplianceStatusValues() []ComplianceStatus { - return []ComplianceStatus{ComplianceStatusCompliant, ComplianceStatusNonCompliant, ComplianceStatusPending} -} - -// ConfigurationMode enumerates the values for configuration mode. -type ConfigurationMode string - -const ( - // ConfigurationModeApplyAndAutoCorrect ... - ConfigurationModeApplyAndAutoCorrect ConfigurationMode = "ApplyAndAutoCorrect" - // ConfigurationModeApplyAndMonitor ... - ConfigurationModeApplyAndMonitor ConfigurationMode = "ApplyAndMonitor" - // ConfigurationModeApplyOnly ... - ConfigurationModeApplyOnly ConfigurationMode = "ApplyOnly" -) - -// PossibleConfigurationModeValues returns an array of possible values for the ConfigurationMode const type. -func PossibleConfigurationModeValues() []ConfigurationMode { - return []ConfigurationMode{ConfigurationModeApplyAndAutoCorrect, ConfigurationModeApplyAndMonitor, ConfigurationModeApplyOnly} -} - -// Kind enumerates the values for kind. -type Kind string - -const ( - // KindDSC ... - KindDSC Kind = "DSC" -) - -// PossibleKindValues returns an array of possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{KindDSC} -} - -// ProvisioningState enumerates the values for provisioning state. -type ProvisioningState string - -const ( - // ProvisioningStateCanceled ... - ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreated ... - ProvisioningStateCreated ProvisioningState = "Created" - // ProvisioningStateFailed ... - ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateSucceeded ... - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ProvisioningStateCanceled, ProvisioningStateCreated, ProvisioningStateFailed, ProvisioningStateSucceeded} -} - -// Type enumerates the values for type. -type Type string - -const ( - // TypeConsistency ... - TypeConsistency Type = "Consistency" - // TypeInitial ... - TypeInitial Type = "Initial" -) - -// PossibleTypeValues returns an array of possible values for the Type const type. -func PossibleTypeValues() []Type { - return []Type{TypeConsistency, TypeInitial} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignmentreports.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignmentreports.go deleted file mode 100644 index 8fb39e36d2da..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignmentreports.go +++ /dev/null @@ -1,203 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// HCRPAssignmentReportsClient is the guest Configuration Client -type HCRPAssignmentReportsClient struct { - BaseClient -} - -// NewHCRPAssignmentReportsClient creates an instance of the HCRPAssignmentReportsClient client. -func NewHCRPAssignmentReportsClient(subscriptionID string) HCRPAssignmentReportsClient { - return NewHCRPAssignmentReportsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHCRPAssignmentReportsClientWithBaseURI creates an instance of the HCRPAssignmentReportsClient client using a -// custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, -// Azure stack). -func NewHCRPAssignmentReportsClientWithBaseURI(baseURI string, subscriptionID string) HCRPAssignmentReportsClient { - return HCRPAssignmentReportsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a report for the guest configuration assignment, by reportId. -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - the guest configuration assignment name. -// reportID - the GUID for the guest configuration assignment report. -// machineName - the name of the ARC machine. -func (client HCRPAssignmentReportsClient) Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, reportID string, machineName string) (result AssignmentReportType, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HCRPAssignmentReportsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.HCRPAssignmentReportsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, reportID, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentReportsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentReportsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentReportsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HCRPAssignmentReportsClient) GetPreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, reportID string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "machineName": autorest.Encode("path", machineName), - "reportId": autorest.Encode("path", reportID), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HCRPAssignmentReportsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HCRPAssignmentReportsClient) GetResponder(resp *http.Response) (result AssignmentReportType, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all reports for the guest configuration assignment, latest report first. -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - the guest configuration assignment name. -// machineName - the name of the ARC machine. -func (client HCRPAssignmentReportsClient) List(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (result AssignmentReportList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HCRPAssignmentReportsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.HCRPAssignmentReportsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentReportsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentReportsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentReportsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client HCRPAssignmentReportsClient) ListPreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client HCRPAssignmentReportsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client HCRPAssignmentReportsClient) ListResponder(resp *http.Response) (result AssignmentReportList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignments.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignments.go deleted file mode 100644 index d0e3cfc8a14e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/hcrpassignments.go +++ /dev/null @@ -1,368 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// HCRPAssignmentsClient is the guest Configuration Client -type HCRPAssignmentsClient struct { - BaseClient -} - -// NewHCRPAssignmentsClient creates an instance of the HCRPAssignmentsClient client. -func NewHCRPAssignmentsClient(subscriptionID string) HCRPAssignmentsClient { - return NewHCRPAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewHCRPAssignmentsClientWithBaseURI creates an instance of the HCRPAssignmentsClient client using a custom endpoint. -// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewHCRPAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) HCRPAssignmentsClient { - return HCRPAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate creates an association between a ARC machine and guest configuration -// Parameters: -// guestConfigurationAssignmentName - name of the guest configuration assignment. -// parameters - parameters supplied to the create or update guest configuration assignment. -// resourceGroupName - the resource group name. -// machineName - the name of the ARC machine. -func (client HCRPAssignmentsClient) CreateOrUpdate(ctx context.Context, guestConfigurationAssignmentName string, parameters Assignment, resourceGroupName string, machineName string) (result Assignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HCRPAssignmentsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.HCRPAssignmentsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, guestConfigurationAssignmentName, parameters, resourceGroupName, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - resp, err := client.CreateOrUpdateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "CreateOrUpdate", resp, "Failure sending request") - return - } - - result, err = client.CreateOrUpdateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "CreateOrUpdate", resp, "Failure responding to request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client HCRPAssignmentsClient) CreateOrUpdatePreparer(ctx context.Context, guestConfigurationAssignmentName string, parameters Assignment, resourceGroupName string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", pathParameters), - autorest.WithJSON(parameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client HCRPAssignmentsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client HCRPAssignmentsClient) CreateOrUpdateResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a guest configuration assignment -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - name of the guest configuration assignment -// machineName - the name of the ARC machine. -func (client HCRPAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (result autorest.Response, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HCRPAssignmentsClient.Delete") - defer func() { - sc := -1 - if result.Response != nil { - sc = result.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.HCRPAssignmentsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = resp - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "Delete", resp, "Failure responding to request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client HCRPAssignmentsClient) DeletePreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client HCRPAssignmentsClient) DeleteSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client HCRPAssignmentsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get information about a guest configuration assignment -// Parameters: -// resourceGroupName - the resource group name. -// guestConfigurationAssignmentName - the guest configuration assignment name. -// machineName - the name of the ARC machine. -func (client HCRPAssignmentsClient) Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (result Assignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HCRPAssignmentsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.HCRPAssignmentsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, guestConfigurationAssignmentName, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client HCRPAssignmentsClient) GetPreparer(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "guestConfigurationAssignmentName": autorest.Encode("path", guestConfigurationAssignmentName), - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetSender sends the Get request. The method will close the -// http.Response Body if it receives an error. -func (client HCRPAssignmentsClient) GetSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetResponder handles the response to the Get request. The method always -// closes the http.Response Body. -func (client HCRPAssignmentsClient) GetResponder(resp *http.Response) (result Assignment, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all guest configuration assignments for an ARC machine. -// Parameters: -// resourceGroupName - the resource group name. -// machineName - the name of the ARC machine. -func (client HCRPAssignmentsClient) List(ctx context.Context, resourceGroupName string, machineName string) (result AssignmentList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/HCRPAssignmentsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("guestconfiguration.HCRPAssignmentsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, machineName) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.HCRPAssignmentsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client HCRPAssignmentsClient) ListPreparer(ctx context.Context, resourceGroupName string, machineName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "machineName": autorest.Encode("path", machineName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client HCRPAssignmentsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client HCRPAssignmentsClient) ListResponder(resp *http.Response) (result AssignmentList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go deleted file mode 100644 index a5d993f0c300..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go +++ /dev/null @@ -1,523 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/date" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration" - -// Assignment guest configuration assignment is an association between a machine and guest configuration. -type Assignment struct { - autorest.Response `json:"-"` - // Properties - Properties of the Guest configuration assignment. - Properties *AssignmentProperties `json:"properties,omitempty"` - // ID - READ-ONLY; ARM resource id of the guest configuration assignment. - ID *string `json:"id,omitempty"` - // Name - Name of the guest configuration assignment. - Name *string `json:"name,omitempty"` - // Location - Region where the VM is located. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Assignment. -func (a Assignment) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Properties != nil { - objectMap["properties"] = a.Properties - } - if a.Name != nil { - objectMap["name"] = a.Name - } - if a.Location != nil { - objectMap["location"] = a.Location - } - return json.Marshal(objectMap) -} - -// AssignmentInfo information about the guest configuration assignment. -type AssignmentInfo struct { - // Name - READ-ONLY; Name of the guest configuration assignment. - Name *string `json:"name,omitempty"` - // Configuration - Information about the configuration. - Configuration *ConfigurationInfo `json:"configuration,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentInfo. -func (ai AssignmentInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ai.Configuration != nil { - objectMap["configuration"] = ai.Configuration - } - return json.Marshal(objectMap) -} - -// AssignmentList the response of the list guest configuration assignment operation. -type AssignmentList struct { - autorest.Response `json:"-"` - // Value - Result of the list guest configuration assignment operation. - Value *[]Assignment `json:"value,omitempty"` -} - -// AssignmentProperties guest configuration assignment properties. -type AssignmentProperties struct { - // TargetResourceID - READ-ONLY; VM resource Id. - TargetResourceID *string `json:"targetResourceId,omitempty"` - // GuestConfiguration - The guest configuration to assign. - GuestConfiguration *Navigation `json:"guestConfiguration,omitempty"` - // ComplianceStatus - READ-ONLY; A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: 'ComplianceStatusCompliant', 'ComplianceStatusNonCompliant', 'ComplianceStatusPending' - ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` - // LastComplianceStatusChecked - READ-ONLY; Date and time when last compliance status was checked. - LastComplianceStatusChecked *date.Time `json:"lastComplianceStatusChecked,omitempty"` - // LatestReportID - READ-ONLY; Id of the latest report for the guest configuration assignment. - LatestReportID *string `json:"latestReportId,omitempty"` - // LatestAssignmentReport - Last reported guest configuration assignment report. - LatestAssignmentReport *AssignmentReport `json:"latestAssignmentReport,omitempty"` - // Context - The source which initiated the guest configuration assignment. Ex: Azure Policy - Context *string `json:"context,omitempty"` - // AssignmentHash - READ-ONLY; Combined hash of the configuration package and parameters. - AssignmentHash *string `json:"assignmentHash,omitempty"` - // ProvisioningState - READ-ONLY; The provisioning state, which only appears in the response. Possible values include: 'ProvisioningStateSucceeded', 'ProvisioningStateFailed', 'ProvisioningStateCanceled', 'ProvisioningStateCreated' - ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentProperties. -func (ap AssignmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.GuestConfiguration != nil { - objectMap["guestConfiguration"] = ap.GuestConfiguration - } - if ap.LatestAssignmentReport != nil { - objectMap["latestAssignmentReport"] = ap.LatestAssignmentReport - } - if ap.Context != nil { - objectMap["context"] = ap.Context - } - return json.Marshal(objectMap) -} - -// AssignmentReport ... -type AssignmentReport struct { - // ID - READ-ONLY; ARM resource id of the report for the guest configuration assignment. - ID *string `json:"id,omitempty"` - // ReportID - READ-ONLY; GUID that identifies the guest configuration assignment report under a subscription, resource group. - ReportID *string `json:"reportId,omitempty"` - // Assignment - Configuration details of the guest configuration assignment. - Assignment *AssignmentInfo `json:"assignment,omitempty"` - // VM - Information about the VM. - VM *VMInfo `json:"vm,omitempty"` - // StartTime - READ-ONLY; Start date and time of the guest configuration assignment compliance status check. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End date and time of the guest configuration assignment compliance status check. - EndTime *date.Time `json:"endTime,omitempty"` - // ComplianceStatus - READ-ONLY; A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: 'ComplianceStatusCompliant', 'ComplianceStatusNonCompliant', 'ComplianceStatusPending' - ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` - // OperationType - READ-ONLY; Type of report, Consistency or Initial. Possible values include: 'TypeConsistency', 'TypeInitial' - OperationType Type `json:"operationType,omitempty"` - // Resources - The list of resources for which guest configuration assignment compliance is checked. - Resources *[]AssignmentReportResource `json:"resources,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentReport. -func (ar AssignmentReport) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ar.Assignment != nil { - objectMap["assignment"] = ar.Assignment - } - if ar.VM != nil { - objectMap["vm"] = ar.VM - } - if ar.Resources != nil { - objectMap["resources"] = ar.Resources - } - return json.Marshal(objectMap) -} - -// AssignmentReportDetails details of the guest configuration assignment report. -type AssignmentReportDetails struct { - // ComplianceStatus - READ-ONLY; A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: 'ComplianceStatusCompliant', 'ComplianceStatusNonCompliant', 'ComplianceStatusPending' - ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` - // StartTime - READ-ONLY; Start date and time of the guest configuration assignment compliance status check. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End date and time of the guest configuration assignment compliance status check. - EndTime *date.Time `json:"endTime,omitempty"` - // JobID - READ-ONLY; GUID of the report. - JobID *string `json:"jobId,omitempty"` - // OperationType - READ-ONLY; Type of report, Consistency or Initial. Possible values include: 'TypeConsistency', 'TypeInitial' - OperationType Type `json:"operationType,omitempty"` - // Resources - The list of resources for which guest configuration assignment compliance is checked. - Resources *[]AssignmentReportResource `json:"resources,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentReportDetails. -func (ard AssignmentReportDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ard.Resources != nil { - objectMap["resources"] = ard.Resources - } - return json.Marshal(objectMap) -} - -// AssignmentReportList list of guest configuration assignment reports. -type AssignmentReportList struct { - autorest.Response `json:"-"` - // Value - List of reports for the guest configuration. Report contains information such as compliance status, reason and more. - Value *[]AssignmentReportType `json:"value,omitempty"` -} - -// AssignmentReportProperties report for the guest configuration assignment. Report contains information -// such as compliance status, reason, and more. -type AssignmentReportProperties struct { - // ComplianceStatus - READ-ONLY; A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: 'ComplianceStatusCompliant', 'ComplianceStatusNonCompliant', 'ComplianceStatusPending' - ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` - // ReportID - READ-ONLY; GUID that identifies the guest configuration assignment report under a subscription, resource group. - ReportID *string `json:"reportId,omitempty"` - // Assignment - Configuration details of the guest configuration assignment. - Assignment *AssignmentInfo `json:"assignment,omitempty"` - // VM - Information about the VM. - VM *VMInfo `json:"vm,omitempty"` - // StartTime - READ-ONLY; Start date and time of the guest configuration assignment compliance status check. - StartTime *date.Time `json:"startTime,omitempty"` - // EndTime - READ-ONLY; End date and time of the guest configuration assignment compliance status check. - EndTime *date.Time `json:"endTime,omitempty"` - // Details - Details of the assignment report. - Details *AssignmentReportDetails `json:"details,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentReportProperties. -func (arp AssignmentReportProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arp.Assignment != nil { - objectMap["assignment"] = arp.Assignment - } - if arp.VM != nil { - objectMap["vm"] = arp.VM - } - if arp.Details != nil { - objectMap["details"] = arp.Details - } - return json.Marshal(objectMap) -} - -// AssignmentReportResource the guest configuration assignment resource. -type AssignmentReportResource struct { - // ComplianceStatus - READ-ONLY; A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: 'ComplianceStatusCompliant', 'ComplianceStatusNonCompliant', 'ComplianceStatusPending' - ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` - // ResourceID - READ-ONLY; Name of the guest configuration assignment resource setting. - ResourceID *string `json:"resourceId,omitempty"` - // Reasons - Compliance reason and reason code for a resource. - Reasons *[]AssignmentReportResourceComplianceReason `json:"reasons,omitempty"` - // Properties - READ-ONLY; Properties of a guest configuration assignment resource. - Properties interface{} `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentReportResource. -func (arr AssignmentReportResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if arr.Reasons != nil { - objectMap["reasons"] = arr.Reasons - } - return json.Marshal(objectMap) -} - -// AssignmentReportResourceComplianceReason reason and code for the compliance of the guest configuration -// assignment resource. -type AssignmentReportResourceComplianceReason struct { - // Phrase - READ-ONLY; Reason for the compliance of the guest configuration assignment resource. - Phrase *string `json:"phrase,omitempty"` - // Code - READ-ONLY; Code for the compliance of the guest configuration assignment resource. - Code *string `json:"code,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentReportResourceComplianceReason. -func (arrcr AssignmentReportResourceComplianceReason) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// AssignmentReportType report for the guest configuration assignment. Report contains information such as -// compliance status, reason, and more. -type AssignmentReportType struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; ARM resource id of the report for the guest configuration assignment. - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; GUID that identifies the guest configuration assignment report under a subscription, resource group. - Name *string `json:"name,omitempty"` - // Properties - Properties of the guest configuration report. - Properties *AssignmentReportProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AssignmentReportType. -func (art AssignmentReportType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if art.Properties != nil { - objectMap["properties"] = art.Properties - } - return json.Marshal(objectMap) -} - -// ConfigurationInfo information about the configuration. -type ConfigurationInfo struct { - // Name - READ-ONLY; Name of the configuration. - Name *string `json:"name,omitempty"` - // Version - READ-ONLY; Version of the configuration. - Version *string `json:"version,omitempty"` -} - -// MarshalJSON is the custom marshaler for ConfigurationInfo. -func (ci ConfigurationInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ConfigurationParameter represents a configuration parameter. -type ConfigurationParameter struct { - // Name - Name of the configuration parameter. - Name *string `json:"name,omitempty"` - // Value - Value of the configuration parameter. - Value *string `json:"value,omitempty"` -} - -// ConfigurationSetting configuration setting of LCM (Local Configuration Manager). -type ConfigurationSetting struct { - // ConfigurationMode - Specifies how the LCM(Local Configuration Manager) actually applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. Possible values include: 'ConfigurationModeApplyOnly', 'ConfigurationModeApplyAndMonitor', 'ConfigurationModeApplyAndAutoCorrect' - ConfigurationMode ConfigurationMode `json:"configurationMode,omitempty"` - // AllowModuleOverwrite - If true - new configurations downloaded from the pull service are allowed to overwrite the old ones on the target node. Otherwise, false - AllowModuleOverwrite *bool `json:"allowModuleOverwrite,omitempty"` - // ActionAfterReboot - Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration. Possible values include: 'ActionAfterRebootContinueConfiguration', 'ActionAfterRebootStopConfiguration' - ActionAfterReboot ActionAfterReboot `json:"actionAfterReboot,omitempty"` - // RefreshFrequencyMins - The time interval, in minutes, at which the LCM checks a pull service to get updated configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. - RefreshFrequencyMins *float64 `json:"refreshFrequencyMins,omitempty"` - // RebootIfNeeded - Set this to true to automatically reboot the node after a configuration that requires reboot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The default value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows Installer), combine this setting with the xPendingReboot module. - RebootIfNeeded *bool `json:"rebootIfNeeded,omitempty"` - // ConfigurationModeFrequencyMins - How often, in minutes, the current configuration is checked and applied. This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. - ConfigurationModeFrequencyMins *float64 `json:"configurationModeFrequencyMins,omitempty"` -} - -// ErrorResponse error response of an operation failure -type ErrorResponse struct { - Error *ErrorResponseError `json:"error,omitempty"` -} - -// ErrorResponseError ... -type ErrorResponseError struct { - // Code - Error code. - Code *string `json:"code,omitempty"` - // Message - Detail error message indicating why the operation failed. - Message *string `json:"message,omitempty"` -} - -// Navigation guest configuration is an artifact that encapsulates DSC configuration and its dependencies. -// The artifact is a zip file containing DSC configuration (as MOF) and dependent resources and other -// dependencies like modules. -type Navigation struct { - // Kind - Kind of the guest configuration. For example:DSC. Possible values include: 'KindDSC' - Kind Kind `json:"kind,omitempty"` - // Name - Name of the guest configuration. - Name *string `json:"name,omitempty"` - // Version - Version of the guest configuration. - Version *string `json:"version,omitempty"` - // ContentURI - Uri of the storage where guest configuration package is uploaded. - ContentURI *string `json:"contentUri,omitempty"` - // ContentHash - Combined hash of the guest configuration package and configuration parameters. - ContentHash *string `json:"contentHash,omitempty"` - // AssignmentType - Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. Possible values include: 'AssignmentTypeAudit', 'AssignmentTypeDeployAndAutoCorrect', 'AssignmentTypeApplyAndAutoCorrect', 'AssignmentTypeApplyAndMonitor' - AssignmentType AssignmentType `json:"assignmentType,omitempty"` - // ConfigurationParameter - The configuration parameters for the guest configuration. - ConfigurationParameter *[]ConfigurationParameter `json:"configurationParameter,omitempty"` - // ConfigurationSetting - The configuration setting for the guest configuration. - ConfigurationSetting *ConfigurationSetting `json:"configurationSetting,omitempty"` -} - -// Operation guestConfiguration REST API operation -type Operation struct { - // Name - Operation name: For ex. providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read - Name *string `json:"name,omitempty"` - // Display - Provider, Resource, Operation and description values. - Display *OperationDisplay `json:"display,omitempty"` - // OperationProperties - Provider, Resource, Operation and description values. - *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Name != nil { - objectMap["name"] = o.Name - } - if o.Display != nil { - objectMap["display"] = o.Display - } - if o.OperationProperties != nil { - objectMap["properties"] = o.OperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Operation struct. -func (o *Operation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - o.Name = &name - } - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - o.Display = &display - } - case "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - o.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay provider, Resource, Operation and description values. -type OperationDisplay struct { - // Provider - Service provider: Microsoft.GuestConfiguration - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: For ex. - Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Description about operation. - Description *string `json:"description,omitempty"` -} - -// OperationList the response model for the list of Automation operations -type OperationList struct { - autorest.Response `json:"-"` - // Value - List of Automation operations supported by the Automation resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// OperationProperties provider, Resource, Operation and description values. -type OperationProperties struct { - // StatusCode - Service provider: Microsoft.GuestConfiguration - StatusCode *string `json:"statusCode,omitempty"` -} - -// ProxyResource ARM proxy resource. -type ProxyResource struct { - // ID - READ-ONLY; ARM resource id of the guest configuration assignment. - ID *string `json:"id,omitempty"` - // Name - Name of the guest configuration assignment. - Name *string `json:"name,omitempty"` - // Location - Region where the VM is located. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pr.Name != nil { - objectMap["name"] = pr.Name - } - if pr.Location != nil { - objectMap["location"] = pr.Location - } - return json.Marshal(objectMap) -} - -// Resource the core properties of ARM resources -type Resource struct { - // ID - READ-ONLY; ARM resource id of the guest configuration assignment. - ID *string `json:"id,omitempty"` - // Name - Name of the guest configuration assignment. - Name *string `json:"name,omitempty"` - // Location - Region where the VM is located. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.Name != nil { - objectMap["name"] = r.Name - } - if r.Location != nil { - objectMap["location"] = r.Location - } - return json.Marshal(objectMap) -} - -// TrackedResource the resource model definition for a ARM tracked top level resource -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // ID - READ-ONLY; ARM resource id of the guest configuration assignment. - ID *string `json:"id,omitempty"` - // Name - Name of the guest configuration assignment. - Name *string `json:"name,omitempty"` - // Location - Region where the VM is located. - Location *string `json:"location,omitempty"` - // Type - READ-ONLY; The type of the resource. - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Name != nil { - objectMap["name"] = tr.Name - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// VMInfo information about the VM. -type VMInfo struct { - // ID - READ-ONLY; Azure resource Id of the VM. - ID *string `json:"id,omitempty"` - // UUID - READ-ONLY; UUID(Universally Unique Identifier) of the VM. - UUID *string `json:"uuid,omitempty"` -} - -// MarshalJSON is the custom marshaler for VMInfo. -func (vi VMInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/operations.go deleted file mode 100644 index d6d453dedbe0..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package guestconfiguration - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the guest Configuration Client -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client using a custom endpoint. Use this -// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available GuestConfiguration REST API operations. -func (client OperationsClient) List(ctx context.Context) (result OperationList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "guestconfiguration.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "guestconfiguration.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2020-06-25" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.GuestConfiguration/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/version.go deleted file mode 100644 index fa49dd2f3253..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package guestconfiguration - -import "github.com/Azure/azure-sdk-for-go/version" - -// 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " guestconfiguration/2020-06-25" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 71adfd625082..9d62a053ebf0 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -9,7 +9,6 @@ github.com/Azure/azure-sdk-for-go/services/cosmos-db/mgmt/2021-10-15/documentdb github.com/Azure/azure-sdk-for-go/services/datafactory/mgmt/2018-06-01/datafactory github.com/Azure/azure-sdk-for-go/services/eventgrid/mgmt/2021-12-01/eventgrid github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-11-01/frontdoor -github.com/Azure/azure-sdk-for-go/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration github.com/Azure/azure-sdk-for-go/services/hdinsight/mgmt/2018-06-01/hdinsight github.com/Azure/azure-sdk-for-go/services/marketplaceordering/mgmt/2015-06-01/marketplaceordering github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql From 9ee089bb7d65def6ef1321d5250574f2f8e23ea1 Mon Sep 17 00:00:00 2001 From: kt Date: Fri, 26 May 2023 08:27:22 -0700 Subject: [PATCH 3/3] Update internal/services/policy/client/client.go Co-authored-by: catriona-m <86247157+catriona-m@users.noreply.github.com> --- internal/services/policy/client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/policy/client/client.go b/internal/services/policy/client/client.go index 38d51b3aab2f..18a73981b223 100644 --- a/internal/services/policy/client/client.go +++ b/internal/services/policy/client/client.go @@ -37,7 +37,7 @@ func NewClient(o *common.ClientOptions) (*Client, error) { guestConfigurationAssignmentsClient, err := guestconfigurationassignments.NewGuestConfigurationAssignmentsClientWithBaseURI(o.Environment.ResourceManager) if err != nil { - return nil, fmt.Errorf("building Guest Configuration Assignments Client client: %+v", err) + return nil, fmt.Errorf("building Guest Configuration Assignments Client: %+v", err) } o.Configure(guestConfigurationAssignmentsClient.Client, o.Authorizers.ResourceManager)