Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WindowsAutopilotDeploymentProfile #228

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions internal/test/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ type Test struct {
UserFlowAttributesClient *msgraph.UserFlowAttributesClient
UsersAppRoleAssignmentsClient *msgraph.AppRoleAssignmentsClient
UsersClient *msgraph.UsersClient
WindowsAutopilotDeploymentProfilesClient *msgraph.WindowsAutopilotDeploymentProfilesClient
}

func NewTest(t *testing.T) (c *Test) {
Expand Down Expand Up @@ -394,5 +395,10 @@ func NewTest(t *testing.T) (c *Test) {
c.UsersClient.BaseClient.Endpoint = *endpoint
c.UsersClient.BaseClient.RetryableClient.RetryMax = retry

c.WindowsAutopilotDeploymentProfilesClient = msgraph.NewWindowsAutopilotDeploymentProfilesClient()
c.WindowsAutopilotDeploymentProfilesClient.BaseClient.Authorizer = c.Connections["default"].Authorizer
c.WindowsAutopilotDeploymentProfilesClient.BaseClient.Endpoint = *endpoint
c.WindowsAutopilotDeploymentProfilesClient.BaseClient.RetryableClient.RetryMax = retry

return
}
79 changes: 79 additions & 0 deletions msgraph/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,11 @@ func (d *DelegatedPermissionGrant) UnmarshalJSON(data []byte) error {
return nil
}

type DeviceAndAppManagementAssignmentTarget struct {
DeviceAndAppManagementAssignmentFilterId *string `json:"deviceAndAppManagementAssignmentFilterId,omitempty"`
DeviceAndAppManagementAssignmentFilterType *DeviceAndAppManagementAssignmentFilterType `json:"deviceAndAppManagementAssignmentFilterType,omitempty"`
}

type DeviceDetail struct {
Browser *string `json:"browser,omitempty"`
DeviceId *string `json:"deviceId,omitempty"`
Expand Down Expand Up @@ -1280,6 +1285,15 @@ type OptionalClaims struct {
Saml2Token *[]OptionalClaim `json:"saml2Token,omitempty"`
}

type OutOfBoxExperienceSettings struct {
HidePrivacySettings *bool `json:"hidePrivacySettings,omitempty"`
HideEULA *bool `json:"hideEULA,omitempty"`
UserType *WindowsUserType `json:"userType,omitempty"`
DeviceUsageType *DeviceUsageType `json:"deviceUsageType,omitempty"`
SkipKeyboardSelectionPage *bool `json:"skipKeyboardSelectionPage,omitempty"`
HideEscapeLink *bool `json:"hideEscapeLink,omitempty"`
}

type ParentalControlSettings struct {
CountriesBlockedForMinors *[]string `json:"countriesBlockedForMinors,omitempty"`
LegalAgeGroupRule *string `json:"legalAgeGroupRule,omitempty"`
Expand Down Expand Up @@ -1847,6 +1861,71 @@ type VerifiedPublisher struct {
VerifiedPublisherId *string `json:"verifiedPublisherId,omitempty"`
}

type WindowsAutopilotDeploymentProfile struct {
ID *string `json:"id,omitempty"`
ODataType *odata.Type `json:"@odata.type,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
Description *string `json:"description,omitempty"`
Language *string `json:"language,omitempty"`
CreatedDateTime *time.Time `json:"createdDateTime,omitempty"`
LastModifiedDateTime *time.Time `json:"lastModifiedDateTime,omitempty"`
OutOfBoxExperienceSettings *OutOfBoxExperienceSettings `json:"outOfBoxExperienceSettings,omitempty"`
EnrollmentStatusScreenSettings *WindowsEnrollmentStatusScreenSettings `json:"enrollmentStatusScreenSettings,omitempty"`
ExtractHardwareHash *bool `json:"extractHardwareHash,omitempty"`
DeviceNameTemplate *string `json:"deviceNameTemplate,omitempty"`
DeviceType *WindowsAutopilotDeviceType `json:"deviceType,omitempty"`
EnableWhiteGlove *bool `json:"enableWhiteGlove,omitempty"`
RoleScopeTagIds *[]string `json:"roleScopeTagIds,omitempty"`
ManagementServiceAppId *string `json:"managementServiceAppId,omitempty"`
HybridAzureADJoinSkipConnectivityCheck *bool `json:"hybridAzureADJoinSkipConnectivityCheck,omitempty"`
}

type WindowsAutopilotDeploymentProfileAssignment struct {
ID *string `json:"id,omitempty"`
Target *DeviceAndAppManagementAssignmentTarget `json:"target,omitempty"`
Source *DeviceAndAppManagementAssignmentSource `json:"source,omitempty"`
SourceId *string `json:"sourceId,omitempty"`
}

type WindowsAutopilotDeviceIdentity struct {
ID *string `json:"id,omitempty"`
DeploymentProfileAssignmentStatus *DeploymentProfileAssignmentStatus `json:"deploymentProfileAssignmentStatus,omitempty"`
DeploymentProfileAssignmentDetailedStatus *WindowsAutopilotProfileAssignmentDetailedStatus `json:"deploymentProfileAssignmentDetailedStatus,omitempty"`
DeploymentProfileAssignedDateTime *time.Time `json:"deploymentProfileAssignedDateTime,omitempty"`
GroupTag *string `json:"groupTag,omitempty"`
PurchaseOrderIdentifier *string `json:"purchaseOrderIdentifier,omitempty"`
SerialNumber *string `json:"serialNumber,omitempty"`
ProductKey *string `json:"productKey,omitempty"`
Manufacturer *string `json:"manufacturer,omitempty"`
Model *string `json:"model,omitempty"`
EnrollmentState *EnrollmentState `json:"enrollmentState,omitempty"`
LastContactedDateTime *time.Time `json:"lastContactedDateTime,omitempty"`
AddressableUserName *string `json:"addressableUserName,omitempty"`
UserPrincipalName *string `json:"userPrincipalName,omitempty"`
ResourceName *string `json:"resourceName,omitempty"`
SkuNumber *string `json:"skuNumber,omitempty"`
SystemFamily *string `json:"systemFamily,omitempty"`
AzureActiveDirectoryDeviceId *string `json:"azureActiveDirectoryDeviceId,omitempty"`
AzureAdDeviceId *string `json:"azureAdDeviceId,omitempty"`
ManagedDeviceId *string `json:"managedDeviceId,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
DeviceAccountUpn *string `json:"deviceAccountUpn,omitempty"`
DeviceAccountPassword *string `json:"deviceAccountPassword,omitempty"`
DeviceFriendlyName *string `json:"deviceFriendlyName,omitempty"`
RemediationState *WindowsAutopilotDeviceRemediationState `json:"remediationState,omitempty"`
RemediationStateLastModifiedDateTime *time.Time `json:"remediationStateLastModifiedDateTime,omitempty"`
}

type WindowsEnrollmentStatusScreenSettings struct {
HideInstallationProgress *bool `json:"hideInstallationProgress,omitempty"`
AllowDeviceUseBeforeProfileAndAppInstallComplete *bool `json:"allowDeviceUseBeforeProfileAndAppInstallComplete,omitempty"`
BlockDeviceSetupRetryByUser *bool `json:"blockDeviceSetupRetryByUser,omitempty"`
AllowLogCollectionOnInstallFailure *bool `json:"allowLogCollectionOnInstallFailure,omitempty"`
CustomErrorMessage *string `json:"customErrorMessage,omitempty"`
InstallProgressTimeoutInMinutes *int32 `json:"installProgressTimeoutInMinutes,omitempty"`
AllowDeviceUseOnInstallFailure *bool `json:"allowDeviceUseOnInstallFailure,omitempty"`
}

type WindowsHelloForBusinessAuthenticationMethod struct {
CreatedDateTime *time.Time `json:"createdDateTime,omitempty"`
DisplayName *string `json:"displayName,omitempty"`
Expand Down
85 changes: 85 additions & 0 deletions msgraph/valuetypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,51 @@ const (
ExpirationPatternTypeAfterDuration ExpirationPatternType = "afterDuration"
)

type DeploymentProfileAssignmentStatus = string

const (
DeploymentProfileAssignmentStatusUnknown DeploymentProfileAssignmentStatus = "unknown"
DeploymentProfileAssignmentStatusAssignedInSync DeploymentProfileAssignmentStatus = "assignedInSync"
DeploymentProfileAssignmentStatusAssignedOutOfSync DeploymentProfileAssignmentStatus = "assignedOutOfSync"
DeploymentProfileAssignmentStatusAssignedUnknownSyncState DeploymentProfileAssignmentStatus = "assignedUnknownSyncState"
DeploymentProfileAssignmentStatusNotAssigned DeploymentProfileAssignmentStatus = "notAssigned"
DeploymentProfileAssignmentStatusPending DeploymentProfileAssignmentStatus = "pending"
DeploymentProfileAssignmentStatusFailed DeploymentProfileAssignmentStatus = "failed"
)

type DeviceUsageType = string

const (
DeviceUsageTypeSingleUser DeviceUsageType = "singleUser"
DeviceUsageTypeShared DeviceUsageType = "shared"
)

type DeviceAndAppManagementAssignmentFilterType = string

const (
DeviceAndAppManagementAssignmentFilterTypeNone DeviceAndAppManagementAssignmentFilterType = "none"
DeviceAndAppManagementAssignmentFilterTypeInclude DeviceAndAppManagementAssignmentFilterType = "include"
DeviceAndAppManagementAssignmentFilterTypeExclude DeviceAndAppManagementAssignmentFilterType = "exclude"
)

type DeviceAndAppManagementAssignmentSource = string

const (
DeviceAndAppManagementAssignmentSourceDirect DeviceAndAppManagementAssignmentSource = "direct"
DeviceAndAppManagementAssignmentSourcePolicySets DeviceAndAppManagementAssignmentSource = "policySets"
)

type EnrollmentState = string

const (
EnrollmentStateUnknown EnrollmentState = "unknown"
EnrollmentStateEnrolled EnrollmentState = "enrolled"
EnrollmentStatePendingReset EnrollmentState = "pendingReset"
EnrollmentStateFailed EnrollmentState = "failed"
EnrollmentStateNotContacted EnrollmentState = "notContacted"
EnrollmentStateBlocked EnrollmentState = "blocked"
)

type ExtensionSchemaTargetType = string

const (
Expand Down Expand Up @@ -754,3 +799,43 @@ const (
IndexTypeFourth IndexType = "fourth"
IndexTypeLast IndexType = "last"
)

type WindowsAutopilotDeviceType = string

const (
WindowsAutopilotDeviceTypeWindowsPc WindowsAutopilotDeviceType = "windowsPc"
WindowsAutopilotDeviceTypeSurfaceHub2 WindowsAutopilotDeviceType = "surfaceHub2"
WindowsAutopilotDeviceTypeHoloLens WindowsAutopilotDeviceType = "holoLens"
WindowsAutopilotDeviceTypeSurfaceHub2S WindowsAutopilotDeviceType = "surfaceHub2S"
WindowsAutopilotDeviceTypeVirtualMachine WindowsAutopilotDeviceType = "virtualMachine"
WindowsAutopilotDeviceTypeUnknownFutureValue WindowsAutopilotDeviceType = "unknownFutureValue"
)

type WindowsAutopilotDeviceRemediationState = string

const (
WindowsAutopilotDeviceRemediationStateUnknown WindowsAutopilotDeviceRemediationState = "unknown"
WindowsAutopilotDeviceRemediationStateNoRemediationRequired WindowsAutopilotDeviceRemediationState = "noRemediationRequired"
WindowsAutopilotDeviceRemediationStateAutomaticRemediationRequired WindowsAutopilotDeviceRemediationState = "automaticRemediationRequired"
WindowsAutopilotDeviceRemediationStateManualRemediationRequired WindowsAutopilotDeviceRemediationState = "manualRemediationRequired"
WindowsAutopilotDeviceRemediationStateUnknownFutureValue WindowsAutopilotDeviceRemediationState = "unknownFutureValue"
)

type WindowsAutopilotProfileAssignmentDetailedStatus = string

const (
WindowsAutopilotProfileAssignmentDetailedStatusNone WindowsAutopilotProfileAssignmentDetailedStatus = "none"
WindowsAutopilotProfileAssignmentDetailedStatusHardwareRequirementsNotMet WindowsAutopilotProfileAssignmentDetailedStatus = "hardwareRequirementsNotMet"
WindowsAutopilotProfileAssignmentDetailedStatusSurfaceHubProfileNotSupported WindowsAutopilotProfileAssignmentDetailedStatus = "surfaceHubProfileNotSupported"
WindowsAutopilotProfileAssignmentDetailedStatusHoloLensProfileNotSupported WindowsAutopilotProfileAssignmentDetailedStatus = "holoLensProfileNotSupported"
WindowsAutopilotProfileAssignmentDetailedStatusWindowsPcProfileNotSupported WindowsAutopilotProfileAssignmentDetailedStatus = "windowsPcProfileNotSupported"
WindowsAutopilotProfileAssignmentDetailedStatusSurfaceHub2SProfileNotSupported WindowsAutopilotProfileAssignmentDetailedStatus = "surfaceHub2SProfileNotSupported"
WindowsAutopilotProfileAssignmentDetailedStatusUnknownFutureValue WindowsAutopilotProfileAssignmentDetailedStatus = "unknownFutureValue"
)

type WindowsUserType = string

const (
WindowsUserTypeAdministrator WindowsUserType = "administrator"
WindowsUserTypeStandard WindowsUserType = "standard"
)
158 changes: 158 additions & 0 deletions msgraph/windows_autopilot_deployment_profiles.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package msgraph

import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"

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

type WindowsAutopilotDeploymentProfilesClient struct {
BaseClient Client
}

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

// List returns a list of Windows Autopilot Deployment Profiles, optionally queried using OData.
func (c *WindowsAutopilotDeploymentProfilesClient) List(ctx context.Context, query odata.Query) (*[]WindowsAutopilotDeploymentProfile, int, error) {
resp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{
DisablePaging: query.Top > 0,
OData: query,
ValidStatusCodes: []int{http.StatusOK},
Uri: Uri{
Entity: "/deviceManagement/windowsAutopilotDeploymentProfiles",
},
})
if err != nil {
return nil, status, fmt.Errorf("WindowsAutopilotDeploymentProfilesClient.BaseClient.Get(): %v", err)
}

defer resp.Body.Close()
respBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, status, fmt.Errorf("io.ReadAll(): %v", err)
}

var data struct {
WindowsAutopilotDeploymentProfiles []WindowsAutopilotDeploymentProfile `json:"value"`
}
if err := json.Unmarshal(respBody, &data); err != nil {
return nil, status, fmt.Errorf("json.Unmarshal(): %v", err)
}

return &data.WindowsAutopilotDeploymentProfiles, status, nil
}

// Create creates a new WindowsAutopilotDeploymentProfile.
func (c *WindowsAutopilotDeploymentProfilesClient) Create(ctx context.Context, profile WindowsAutopilotDeploymentProfile) (*WindowsAutopilotDeploymentProfile, int, error) {
var status int
body, err := json.Marshal(profile)
if err != nil {
return nil, status, fmt.Errorf("json.Marshal(): %v", err)
}

resp, status, _, err := c.BaseClient.Post(ctx, PostHttpRequestInput{
Body: body,
ValidStatusCodes: []int{http.StatusCreated},
Uri: Uri{
Entity: "/deviceManagement/windowsAutopilotDeploymentProfiles",
},
})
if err != nil {
return nil, status, fmt.Errorf("WindowsAutopilotDeploymentProfilesClient.BaseClient.Post(): %v", err)
}

defer resp.Body.Close()
respBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, status, fmt.Errorf("io.ReadAll(): %v", err)
}

var newWindowsAutopilotDeploymentProfile WindowsAutopilotDeploymentProfile
if err := json.Unmarshal(respBody, &newWindowsAutopilotDeploymentProfile); err != nil {
return nil, status, fmt.Errorf("json.Unmarshal(): %v", err)
}

return &newWindowsAutopilotDeploymentProfile, status, nil
}

// Get retrieves a WindowsAutopilotDeploymentProfile.
func (c *WindowsAutopilotDeploymentProfilesClient) Get(ctx context.Context, id string, query odata.Query) (*WindowsAutopilotDeploymentProfile, int, error) {
resp, status, _, err := c.BaseClient.Get(ctx, GetHttpRequestInput{
ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc,
OData: query,
ValidStatusCodes: []int{http.StatusOK},
Uri: Uri{
Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", id),
},
})
if err != nil {
return nil, status, fmt.Errorf("WindowsAutopilotDeploymentProfilesClient.BaseClient.Get(): %v", err)
}

defer resp.Body.Close()
respBody, err := io.ReadAll(resp.Body)
if err != nil {
return nil, status, fmt.Errorf("io.ReadAll(): %v", err)
}

var windowsAutopilotDeploymentProfile WindowsAutopilotDeploymentProfile
if err := json.Unmarshal(respBody, &windowsAutopilotDeploymentProfile); err != nil {
return nil, status, fmt.Errorf("json.Unmarshal(): %v", err)
}

return &windowsAutopilotDeploymentProfile, status, nil
}

// Update amends an existing WindowsAutopilotDeploymentProfile.
func (c *WindowsAutopilotDeploymentProfilesClient) Update(ctx context.Context, profile WindowsAutopilotDeploymentProfile) (int, error) {
var status int

if profile.ID == nil {
return status, errors.New("cannot update windowsAutopilotDeploymentProfile with nil ID")
}

body, err := json.Marshal(profile)
if err != nil {
return status, fmt.Errorf("json.Marshal(): %v", err)
}

_, status, _, err = c.BaseClient.Patch(ctx, PatchHttpRequestInput{
Body: body,
ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc,
ValidStatusCodes: []int{http.StatusOK, http.StatusNoContent},
Uri: Uri{
Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", *profile.ID),
},
})
if err != nil {
return status, fmt.Errorf("WindowsAutopilotDeploymentProfilesClient.BaseClient.Patch(): %v", err)
}

return status, nil
}

// Delete removes a WindowsAutopilotDeploymentProfile.
func (c *WindowsAutopilotDeploymentProfilesClient) Delete(ctx context.Context, id string) (int, error) {
_, status, _, err := c.BaseClient.Delete(ctx, DeleteHttpRequestInput{
ConsistencyFailureFunc: RetryOn404ConsistencyFailureFunc,
ValidStatusCodes: []int{http.StatusOK, http.StatusNoContent},
Uri: Uri{
Entity: fmt.Sprintf("/deviceManagement/windowsAutopilotDeploymentProfiles/%s", id),
},
})
if err != nil {
return status, fmt.Errorf("WindowsAutopilotDeploymentProfilesClient.BaseClient.Delete(): %v", err)
}

return status, nil
}
Loading