diff --git a/go.mod b/go.mod index 4ac69233..6813b2de 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,10 @@ module github.com/manicminer/hamilton go 1.16 require ( - github.com/hashicorp/go-azure-sdk v0.20230223.1132808 + github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect + github.com/hashicorp/go-azure-sdk v0.20230322.1105901 github.com/hashicorp/go-retryablehttp v0.7.2 github.com/hashicorp/go-uuid v1.0.3 + github.com/manicminer/hamilton-autorest v0.3.0 // indirect golang.org/x/oauth2 v0.4.0 ) diff --git a/go.sum b/go.sum index 2404f4a6..2621c802 100644 --- a/go.sum +++ b/go.sum @@ -172,6 +172,8 @@ github.com/hashicorp/go-azure-sdk v0.20230222.1112900 h1:vnsNTndyHAkbhGqoWfGIKa8 github.com/hashicorp/go-azure-sdk v0.20230222.1112900/go.mod h1:bilGy5T79PVRkSDDWvTLP0L/vB1L8+Aj1WlMnp5jUqA= github.com/hashicorp/go-azure-sdk v0.20230223.1132808 h1:3RTwCTiY42qQjN8rzi4QABWzYyMEp8ZqdWf7K7XzAXo= github.com/hashicorp/go-azure-sdk v0.20230223.1132808/go.mod h1:lU3F9c+qXc7iqMayTNmUP/VDc0H6f95mkhv4u35zV8I= +github.com/hashicorp/go-azure-sdk v0.20230322.1105901 h1:a/7ILVAgRkYJiJ8gh41DVJb3qSQf0eRau6hyKbxU4JI= +github.com/hashicorp/go-azure-sdk v0.20230322.1105901/go.mod h1:L9JXVUcnL0GjMizCnngYUlMp1lLhDBNgSTvn6Of/5O4= github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= diff --git a/internal/test/testing.go b/internal/test/testing.go index a094de94..f04ae3aa 100644 --- a/internal/test/testing.go +++ b/internal/test/testing.go @@ -395,9 +395,9 @@ func NewTest(t *testing.T) (c *Test) { c.UsersClient.BaseClient.Endpoint = *endpoint c.UsersClient.BaseClient.RetryableClient.RetryMax = retry - c.WindowsAutopilotDeploymentProfilesClient = msgraph.NewWindowsAutopilotDeploymentProfilesClient(c.Connections["default"].AuthConfig.TenantID) + c.WindowsAutopilotDeploymentProfilesClient = msgraph.NewWindowsAutopilotDeploymentProfilesClient() c.WindowsAutopilotDeploymentProfilesClient.BaseClient.Authorizer = c.Connections["default"].Authorizer - c.WindowsAutopilotDeploymentProfilesClient.BaseClient.Endpoint = c.Connections["default"].AuthConfig.Environment.MsGraph.Endpoint + c.WindowsAutopilotDeploymentProfilesClient.BaseClient.Endpoint = *endpoint c.WindowsAutopilotDeploymentProfilesClient.BaseClient.RetryableClient.RetryMax = retry return diff --git a/msgraph/windows_autopilot_deployment_profiles.go b/msgraph/windows_autopilot_deployment_profiles.go index 31320655..5f7d4f91 100644 --- a/msgraph/windows_autopilot_deployment_profiles.go +++ b/msgraph/windows_autopilot_deployment_profiles.go @@ -5,9 +5,10 @@ import ( "encoding/json" "errors" "fmt" - "github.com/manicminer/hamilton/odata" "io" "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/odata" ) type WindowsAutopilotDeploymentProfilesClient struct { @@ -15,9 +16,9 @@ type WindowsAutopilotDeploymentProfilesClient struct { } // NewWindowsAutopilotDeploymentProfilesClient returns a new WindowsAutopilotDeploymentProfilesClient. -func NewWindowsAutopilotDeploymentProfilesClient(tenantId string) *WindowsAutopilotDeploymentProfilesClient { +func NewWindowsAutopilotDeploymentProfilesClient() *WindowsAutopilotDeploymentProfilesClient { return &WindowsAutopilotDeploymentProfilesClient{ - BaseClient: NewClient(VersionBeta, tenantId), + BaseClient: NewClient(VersionBeta), } } @@ -28,8 +29,7 @@ func (c *WindowsAutopilotDeploymentProfilesClient) List(ctx context.Context, que OData: query, ValidStatusCodes: []int{http.StatusOK}, Uri: Uri{ - Entity: "/deviceManagement/windowsAutopilotDeploymentProfiles", - HasTenantId: true, + Entity: "/deviceManagement/windowsAutopilotDeploymentProfiles", }, }) if err != nil { @@ -59,15 +59,12 @@ func (c *WindowsAutopilotDeploymentProfilesClient) Create(ctx context.Context, p if err != nil { return nil, status, fmt.Errorf("json.Marshal(): %v", err) } - hoge := string(body) - fmt.Printf(hoge) resp, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{ Body: body, ValidStatusCodes: []int{http.StatusCreated}, Uri: Uri{ - Entity: "/deviceManagement/windowsAutopilotDeploymentProfiles", - HasTenantId: true, + Entity: "/deviceManagement/windowsAutopilotDeploymentProfiles", }, }) if err != nil { @@ -95,8 +92,7 @@ func (c *WindowsAutopilotDeploymentProfilesClient) Get(ctx context.Context, id s OData: query, ValidStatusCodes: []int{http.StatusOK}, Uri: Uri{ - Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", id), - HasTenantId: true, + Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", id), }, }) if err != nil { @@ -135,8 +131,7 @@ func (c *WindowsAutopilotDeploymentProfilesClient) Update(ctx context.Context, p ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, ValidStatusCodes: []int{http.StatusOK, http.StatusNoContent}, Uri: Uri{ - Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", *profile.ID), - HasTenantId: true, + Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", *profile.ID), }, }) if err != nil { @@ -152,8 +147,7 @@ func (c *WindowsAutopilotDeploymentProfilesClient) Delete(ctx context.Context, i ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc, ValidStatusCodes: []int{http.StatusOK, http.StatusNoContent}, Uri: Uri{ - Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", id), - HasTenantId: true, + Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", id), }, }) if err != nil { diff --git a/msgraph/windows_autopilot_deployment_profiles_test.go b/msgraph/windows_autopilot_deployment_profiles_test.go index 0f4c0cea..c6dfa81c 100644 --- a/msgraph/windows_autopilot_deployment_profiles_test.go +++ b/msgraph/windows_autopilot_deployment_profiles_test.go @@ -4,10 +4,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/sdk/odata" + "github.com/manicminer/hamilton/internal/test" "github.com/manicminer/hamilton/internal/utils" "github.com/manicminer/hamilton/msgraph" - "github.com/manicminer/hamilton/odata" ) func TestWindowsAutopilotDeploymentProfilesClient(t *testing.T) {