Skip to content

Commit

Permalink
Changed odata reference to hashicorp/go-azure-sdk for WindowsAutopilo…
Browse files Browse the repository at this point in the history
…tDeploymentProfiles
  • Loading branch information
kenchan0130 committed Mar 22, 2023
1 parent e60e5d9 commit 99cc5c0
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 2 additions & 2 deletions internal/test/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 9 additions & 15 deletions msgraph/windows_autopilot_deployment_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/manicminer/hamilton/odata"
"io"
"net/http"

"github.com/hashicorp/go-azure-sdk/sdk/odata"
)

type WindowsAutopilotDeploymentProfilesClient struct {
BaseClient Client
}

// NewWindowsAutopilotDeploymentProfilesClient returns a new WindowsAutopilotDeploymentProfilesClient.
func NewWindowsAutopilotDeploymentProfilesClient(tenantId string) *WindowsAutopilotDeploymentProfilesClient {
func NewWindowsAutopilotDeploymentProfilesClient() *WindowsAutopilotDeploymentProfilesClient {
return &WindowsAutopilotDeploymentProfilesClient{
BaseClient: NewClient(VersionBeta, tenantId),
BaseClient: NewClient(VersionBeta),
}
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion msgraph/windows_autopilot_deployment_profiles_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 99cc5c0

Please sign in to comment.