diff --git a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md index 52911e4cc5e4..d3918afbfbb3 100644 --- a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md +++ b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/CHANGELOG.md @@ -1,2 +1,31 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AssignmentsClient.RGList(context.Context, string) (AssignmentList, error) +1. AssignmentsClient.RGListPreparer(context.Context, string) (*http.Request, error) +1. AssignmentsClient.RGListResponder(*http.Response) (AssignmentList, error) +1. AssignmentsClient.RGListSender(*http.Request) (*http.Response, error) +1. AssignmentsClient.SubscriptionList(context.Context) (AssignmentList, error) +1. AssignmentsClient.SubscriptionListPreparer(context.Context) (*http.Request, error) +1. AssignmentsClient.SubscriptionListResponder(*http.Response) (AssignmentList, error) +1. AssignmentsClient.SubscriptionListSender(*http.Request) (*http.Response, error) +1. Navigation.MarshalJSON() ([]byte, error) +1. VMSSVMInfo.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. VMSSVMInfo + +#### New Struct Fields + +1. AssignmentProperties.ParameterHash +1. AssignmentProperties.ResourceType +1. AssignmentProperties.VmssVMList +1. AssignmentReportProperties.VmssResourceID +1. Navigation.ConfigurationProtectedParameter +1. Navigation.ContentType diff --git a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json index 67f6047b7424..ba82f01f922e 100644 --- a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json +++ b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "6e95cd4c6086d61bb3de67cf6e4209a7b84efa23", + "commit": "b72597d9112b6f2e41d9ff70dea876631ac9f70d", "readme": "/_/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.md", "tag": "package-2020-06-25", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go index 77b15705e904..adb1cbf48bee 100644 --- a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go +++ b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/assignments.go @@ -366,3 +366,154 @@ func (client AssignmentsClient) ListResponder(resp *http.Response) (result Assig result.Response = autorest.Response{Response: resp} return } + +// RGList list all guest configuration assignments for a resource group. +// Parameters: +// resourceGroupName - the resource group name. +func (client AssignmentsClient) RGList(ctx context.Context, resourceGroupName string) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.RGList") + 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", "RGList", err.Error()) + } + + req, err := client.RGListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", nil, "Failure preparing request") + return + } + + resp, err := client.RGListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", resp, "Failure sending request") + return + } + + result, err = client.RGListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", resp, "Failure responding to request") + return + } + + return +} + +// RGListPreparer prepares the RGList request. +func (client AssignmentsClient) RGListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "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.GuestConfiguration/guestConfigurationAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RGListSender sends the RGList request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) RGListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RGListResponder handles the response to the RGList request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) RGListResponder(resp *http.Response) (result AssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SubscriptionList list all guest configuration assignments for a subscription. +func (client AssignmentsClient) SubscriptionList(ctx context.Context) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.SubscriptionList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SubscriptionListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", nil, "Failure preparing request") + return + } + + resp, err := client.SubscriptionListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", resp, "Failure sending request") + return + } + + result, err = client.SubscriptionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", resp, "Failure responding to request") + return + } + + return +} + +// SubscriptionListPreparer prepares the SubscriptionList request. +func (client AssignmentsClient) SubscriptionListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "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}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SubscriptionListSender sends the SubscriptionList request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) SubscriptionListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SubscriptionListResponder handles the response to the SubscriptionList request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) SubscriptionListResponder(resp *http.Response) (result AssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/guestconfigurationapi/interfaces.go b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/guestconfigurationapi/interfaces.go index 9468343c4d30..26fcf7662f0d 100644 --- a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/guestconfigurationapi/interfaces.go +++ b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/guestconfigurationapi/interfaces.go @@ -18,6 +18,8 @@ type AssignmentsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result guestconfiguration.Assignment, err error) List(ctx context.Context, resourceGroupName string, VMName string) (result guestconfiguration.AssignmentList, err error) + RGList(ctx context.Context, resourceGroupName string) (result guestconfiguration.AssignmentList, err error) + SubscriptionList(ctx context.Context) (result guestconfiguration.AssignmentList, err error) } var _ AssignmentsClientAPI = (*guestconfiguration.AssignmentsClient)(nil) diff --git a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go index a5d993f0c300..d5353e8d77ce 100644 --- a/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go +++ b/services/guestconfiguration/mgmt/2020-06-25/guestconfiguration/models.go @@ -81,6 +81,12 @@ type AssignmentProperties struct { LastComplianceStatusChecked *date.Time `json:"lastComplianceStatusChecked,omitempty"` // LatestReportID - READ-ONLY; Id of the latest report for the guest configuration assignment. LatestReportID *string `json:"latestReportId,omitempty"` + // ParameterHash - READ-ONLY; parameter hash for the guest configuration assignment. + ParameterHash *string `json:"parameterHash,omitempty"` + // ResourceType - READ-ONLY; Type of the resource - VMSS / VM + ResourceType *string `json:"resourceType,omitempty"` + // VmssVMList - The list of VM Compliance data for VMSS + VmssVMList *[]VMSSVMInfo `json:"vmssVMList,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 @@ -97,6 +103,9 @@ func (ap AssignmentProperties) MarshalJSON() ([]byte, error) { if ap.GuestConfiguration != nil { objectMap["guestConfiguration"] = ap.GuestConfiguration } + if ap.VmssVMList != nil { + objectMap["vmssVMList"] = ap.VmssVMList + } if ap.LatestAssignmentReport != nil { objectMap["latestAssignmentReport"] = ap.LatestAssignmentReport } @@ -192,6 +201,8 @@ type AssignmentReportProperties struct { EndTime *date.Time `json:"endTime,omitempty"` // Details - Details of the assignment report. Details *AssignmentReportDetails `json:"details,omitempty"` + // VmssResourceID - READ-ONLY; Azure resource Id of the VMSS. + VmssResourceID *string `json:"vmssResourceId,omitempty"` } // MarshalJSON is the custom marshaler for AssignmentReportProperties. @@ -333,12 +344,49 @@ type Navigation struct { 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"` + // ContentType - READ-ONLY; Specifies the content type of the configuration. Possible values could be Builtin or Custom. + ContentType *string `json:"contentType,omitempty"` // ConfigurationParameter - The configuration parameters for the guest configuration. ConfigurationParameter *[]ConfigurationParameter `json:"configurationParameter,omitempty"` + // ConfigurationProtectedParameter - The protected configuration parameters for the guest configuration. + ConfigurationProtectedParameter *[]ConfigurationParameter `json:"configurationProtectedParameter,omitempty"` // ConfigurationSetting - The configuration setting for the guest configuration. ConfigurationSetting *ConfigurationSetting `json:"configurationSetting,omitempty"` } +// MarshalJSON is the custom marshaler for Navigation. +func (n Navigation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if n.Kind != "" { + objectMap["kind"] = n.Kind + } + if n.Name != nil { + objectMap["name"] = n.Name + } + if n.Version != nil { + objectMap["version"] = n.Version + } + if n.ContentURI != nil { + objectMap["contentUri"] = n.ContentURI + } + if n.ContentHash != nil { + objectMap["contentHash"] = n.ContentHash + } + if n.AssignmentType != "" { + objectMap["assignmentType"] = n.AssignmentType + } + if n.ConfigurationParameter != nil { + objectMap["configurationParameter"] = n.ConfigurationParameter + } + if n.ConfigurationProtectedParameter != nil { + objectMap["configurationProtectedParameter"] = n.ConfigurationProtectedParameter + } + if n.ConfigurationSetting != nil { + objectMap["configurationSetting"] = n.ConfigurationSetting + } + return json.Marshal(objectMap) +} + // Operation guestConfiguration REST API operation type Operation struct { // Name - Operation name: For ex. providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read @@ -521,3 +569,23 @@ func (vi VMInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) return json.Marshal(objectMap) } + +// VMSSVMInfo information about VMSS VM +type VMSSVMInfo struct { + // VMID - READ-ONLY; UUID of the VM. + VMID *string `json:"vmId,omitempty"` + // VMResourceID - READ-ONLY; Azure resource Id of the VM. + VMResourceID *string `json:"vmResourceId,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"` + // LatestReportID - READ-ONLY; Id of the latest report for the guest configuration assignment. + LatestReportID *string `json:"latestReportId,omitempty"` + // LastComplianceChecked - READ-ONLY; Date and time when last compliance status was checked. + LastComplianceChecked *date.Time `json:"lastComplianceChecked,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMSSVMInfo. +func (vi VMSSVMInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/CHANGELOG.md b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/CHANGELOG.md index 52911e4cc5e4..2aaa4ad1e29e 100644 --- a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/CHANGELOG.md +++ b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/CHANGELOG.md @@ -1,2 +1,23 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. AssignmentsClient.RGList(context.Context, string) (AssignmentList, error) +1. AssignmentsClient.RGListPreparer(context.Context, string) (*http.Request, error) +1. AssignmentsClient.RGListResponder(*http.Response) (AssignmentList, error) +1. AssignmentsClient.RGListSender(*http.Request) (*http.Response, error) +1. AssignmentsClient.SubscriptionList(context.Context) (AssignmentList, error) +1. AssignmentsClient.SubscriptionListPreparer(context.Context) (*http.Request, error) +1. AssignmentsClient.SubscriptionListResponder(*http.Response) (AssignmentList, error) +1. AssignmentsClient.SubscriptionListSender(*http.Request) (*http.Response, error) +1. Navigation.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Struct Fields + +1. AssignmentProperties.ParameterHash +1. Navigation.ConfigurationProtectedParameter +1. Navigation.ContentType diff --git a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/_meta.json b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/_meta.json index 05b428589dc2..050e4158e078 100644 --- a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/_meta.json +++ b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/_meta.json @@ -1,5 +1,5 @@ { - "commit": "6e95cd4c6086d61bb3de67cf6e4209a7b84efa23", + "commit": "b72597d9112b6f2e41d9ff70dea876631ac9f70d", "readme": "/_/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.md", "tag": "package-2021-01-25", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/assignments.go b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/assignments.go index fdba58df1faf..ca0efc15e5f4 100644 --- a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/assignments.go +++ b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/assignments.go @@ -367,3 +367,154 @@ func (client AssignmentsClient) ListResponder(resp *http.Response) (result Assig result.Response = autorest.Response{Response: resp} return } + +// RGList list all guest configuration assignments for a resource group. +// Parameters: +// resourceGroupName - the resource group name. +func (client AssignmentsClient) RGList(ctx context.Context, resourceGroupName string) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.RGList") + 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", "RGList", err.Error()) + } + + req, err := client.RGListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", nil, "Failure preparing request") + return + } + + resp, err := client.RGListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", resp, "Failure sending request") + return + } + + result, err = client.RGListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", resp, "Failure responding to request") + return + } + + return +} + +// RGListPreparer prepares the RGList request. +func (client AssignmentsClient) RGListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-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.GuestConfiguration/guestConfigurationAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RGListSender sends the RGList request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) RGListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RGListResponder handles the response to the RGList request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) RGListResponder(resp *http.Response) (result AssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SubscriptionList list all guest configuration assignments for a subscription. +func (client AssignmentsClient) SubscriptionList(ctx context.Context) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.SubscriptionList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SubscriptionListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", nil, "Failure preparing request") + return + } + + resp, err := client.SubscriptionListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", resp, "Failure sending request") + return + } + + result, err = client.SubscriptionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", resp, "Failure responding to request") + return + } + + return +} + +// SubscriptionListPreparer prepares the SubscriptionList request. +func (client AssignmentsClient) SubscriptionListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2021-01-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SubscriptionListSender sends the SubscriptionList request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) SubscriptionListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SubscriptionListResponder handles the response to the SubscriptionList request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) SubscriptionListResponder(resp *http.Response) (result AssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/guestconfigurationapi/interfaces.go b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/guestconfigurationapi/interfaces.go index f8e616090832..74a27c765088 100644 --- a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/guestconfigurationapi/interfaces.go +++ b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/guestconfigurationapi/interfaces.go @@ -18,6 +18,8 @@ type AssignmentsClientAPI interface { Delete(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result autorest.Response, err error) Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result guestconfiguration.Assignment, err error) List(ctx context.Context, resourceGroupName string, VMName string) (result guestconfiguration.AssignmentList, err error) + RGList(ctx context.Context, resourceGroupName string) (result guestconfiguration.AssignmentList, err error) + SubscriptionList(ctx context.Context) (result guestconfiguration.AssignmentList, err error) } var _ AssignmentsClientAPI = (*guestconfiguration.AssignmentsClient)(nil) diff --git a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/models.go b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/models.go index 972d69ac3061..7b47cc1a468a 100644 --- a/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/models.go +++ b/services/guestconfiguration/mgmt/2021-01-25/guestconfiguration/models.go @@ -83,6 +83,8 @@ type AssignmentProperties struct { LastComplianceStatusChecked *date.Time `json:"lastComplianceStatusChecked,omitempty"` // LatestReportID - READ-ONLY; Id of the latest report for the guest configuration assignment. LatestReportID *string `json:"latestReportId,omitempty"` + // ParameterHash - READ-ONLY; parameter hash for the guest configuration assignment. + ParameterHash *string `json:"parameterHash,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 @@ -344,12 +346,49 @@ type Navigation struct { 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"` + // ContentType - READ-ONLY; Specifies the content type of the configuration. Possible values could be Builtin or Custom. + ContentType *string `json:"contentType,omitempty"` // ConfigurationParameter - The configuration parameters for the guest configuration. ConfigurationParameter *[]ConfigurationParameter `json:"configurationParameter,omitempty"` + // ConfigurationProtectedParameter - The protected configuration parameters for the guest configuration. + ConfigurationProtectedParameter *[]ConfigurationParameter `json:"configurationProtectedParameter,omitempty"` // ConfigurationSetting - The configuration setting for the guest configuration. ConfigurationSetting *ConfigurationSetting `json:"configurationSetting,omitempty"` } +// MarshalJSON is the custom marshaler for Navigation. +func (n Navigation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if n.Kind != "" { + objectMap["kind"] = n.Kind + } + if n.Name != nil { + objectMap["name"] = n.Name + } + if n.Version != nil { + objectMap["version"] = n.Version + } + if n.ContentURI != nil { + objectMap["contentUri"] = n.ContentURI + } + if n.ContentHash != nil { + objectMap["contentHash"] = n.ContentHash + } + if n.AssignmentType != "" { + objectMap["assignmentType"] = n.AssignmentType + } + if n.ConfigurationParameter != nil { + objectMap["configurationParameter"] = n.ConfigurationParameter + } + if n.ConfigurationProtectedParameter != nil { + objectMap["configurationProtectedParameter"] = n.ConfigurationProtectedParameter + } + if n.ConfigurationSetting != nil { + objectMap["configurationSetting"] = n.ConfigurationSetting + } + return json.Marshal(objectMap) +} + // Operation guestConfiguration REST API operation type Operation struct { // Name - Operation name: For ex. providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/write or read diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/CHANGELOG.md b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/CHANGELOG.md new file mode 100644 index 000000000000..a1ecf841edb0 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/CHANGELOG.md @@ -0,0 +1,2 @@ +# Unreleased + diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/_meta.json b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/_meta.json new file mode 100644 index 000000000000..44ae74a750bb --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/_meta.json @@ -0,0 +1,11 @@ +{ + "commit": "b72597d9112b6f2e41d9ff70dea876631ac9f70d", + "readme": "/_/azure-rest-api-specs/specification/guestconfiguration/resource-manager/readme.md", + "tag": "package-2022-01-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-2022-01-25 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION /_/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" + } +} \ No newline at end of file diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentreports.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentreports.go new file mode 100644 index 000000000000..b1df5e9873f8 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentreports.go @@ -0,0 +1,203 @@ +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 = "2022-01-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 = "2022-01-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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentreportsvmss.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentreportsvmss.go new file mode 100644 index 000000000000..d54ba947ab25 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentreportsvmss.go @@ -0,0 +1,203 @@ +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" +) + +// AssignmentReportsVMSSClient is the guest Configuration Client +type AssignmentReportsVMSSClient struct { + BaseClient +} + +// NewAssignmentReportsVMSSClient creates an instance of the AssignmentReportsVMSSClient client. +func NewAssignmentReportsVMSSClient(subscriptionID string) AssignmentReportsVMSSClient { + return NewAssignmentReportsVMSSClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAssignmentReportsVMSSClientWithBaseURI creates an instance of the AssignmentReportsVMSSClient 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 NewAssignmentReportsVMSSClientWithBaseURI(baseURI string, subscriptionID string) AssignmentReportsVMSSClient { + return AssignmentReportsVMSSClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get a report for the VMSS guest configuration assignment, by reportId. +// Parameters: +// resourceGroupName - the resource group name. +// vmssName - the name of the virtual machine scale set. +// name - the guest configuration assignment name. +// ID - the GUID for the guest configuration assignment report. +func (client AssignmentReportsVMSSClient) Get(ctx context.Context, resourceGroupName string, vmssName string, name string, ID string) (result AssignmentReportType, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentReportsVMSSClient.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.AssignmentReportsVMSSClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, vmssName, name, ID) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsVMSSClient", "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.AssignmentReportsVMSSClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsVMSSClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AssignmentReportsVMSSClient) GetPreparer(ctx context.Context, resourceGroupName string, vmssName string, name string, ID string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "id": autorest.Encode("path", ID), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmssName": autorest.Encode("path", vmssName), + } + + const APIVersion = "2022-01-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/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/reports/{id}", 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 AssignmentReportsVMSSClient) 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 AssignmentReportsVMSSClient) 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 VMSS guest configuration assignment, latest report first. +// Parameters: +// resourceGroupName - the resource group name. +// vmssName - the name of the virtual machine scale set. +// name - the guest configuration assignment name. +func (client AssignmentReportsVMSSClient) List(ctx context.Context, resourceGroupName string, vmssName string, name string) (result AssignmentReportList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentReportsVMSSClient.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.AssignmentReportsVMSSClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, vmssName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsVMSSClient", "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.AssignmentReportsVMSSClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentReportsVMSSClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AssignmentReportsVMSSClient) ListPreparer(ctx context.Context, resourceGroupName string, vmssName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmssName": autorest.Encode("path", vmssName), + } + + const APIVersion = "2022-01-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/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}/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 AssignmentReportsVMSSClient) 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 AssignmentReportsVMSSClient) 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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignments.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignments.go new file mode 100644 index 000000000000..065151f9b3b7 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignments.go @@ -0,0 +1,520 @@ +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 = "2022-01-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + 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 = "2022-01-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 = "2022-01-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 = "2022-01-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 +} + +// RGList list all guest configuration assignments for a resource group. +// Parameters: +// resourceGroupName - the resource group name. +func (client AssignmentsClient) RGList(ctx context.Context, resourceGroupName string) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.RGList") + 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", "RGList", err.Error()) + } + + req, err := client.RGListPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", nil, "Failure preparing request") + return + } + + resp, err := client.RGListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", resp, "Failure sending request") + return + } + + result, err = client.RGListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "RGList", resp, "Failure responding to request") + return + } + + return +} + +// RGListPreparer prepares the RGList request. +func (client AssignmentsClient) RGListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-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.GuestConfiguration/guestConfigurationAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RGListSender sends the RGList request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) RGListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// RGListResponder handles the response to the RGList request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) RGListResponder(resp *http.Response) (result AssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// SubscriptionList list all guest configuration assignments for a subscription. +func (client AssignmentsClient) SubscriptionList(ctx context.Context) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsClient.SubscriptionList") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.SubscriptionListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", nil, "Failure preparing request") + return + } + + resp, err := client.SubscriptionListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", resp, "Failure sending request") + return + } + + result, err = client.SubscriptionListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsClient", "SubscriptionList", resp, "Failure responding to request") + return + } + + return +} + +// SubscriptionListPreparer prepares the SubscriptionList request. +func (client AssignmentsClient) SubscriptionListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2022-01-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// SubscriptionListSender sends the SubscriptionList request. The method will close the +// http.Response Body if it receives an error. +func (client AssignmentsClient) SubscriptionListSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// SubscriptionListResponder handles the response to the SubscriptionList request. The method always +// closes the http.Response Body. +func (client AssignmentsClient) SubscriptionListResponder(resp *http.Response) (result AssignmentList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentsvmss.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentsvmss.go new file mode 100644 index 000000000000..bcf17e23d27b --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/assignmentsvmss.go @@ -0,0 +1,282 @@ +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" +) + +// AssignmentsVMSSClient is the guest Configuration Client +type AssignmentsVMSSClient struct { + BaseClient +} + +// NewAssignmentsVMSSClient creates an instance of the AssignmentsVMSSClient client. +func NewAssignmentsVMSSClient(subscriptionID string) AssignmentsVMSSClient { + return NewAssignmentsVMSSClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAssignmentsVMSSClientWithBaseURI creates an instance of the AssignmentsVMSSClient 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 NewAssignmentsVMSSClientWithBaseURI(baseURI string, subscriptionID string) AssignmentsVMSSClient { + return AssignmentsVMSSClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Delete delete a guest configuration assignment for VMSS +// Parameters: +// resourceGroupName - the resource group name. +// vmssName - the name of the virtual machine scale set. +// name - the guest configuration assignment name. +func (client AssignmentsVMSSClient) Delete(ctx context.Context, resourceGroupName string, vmssName string, name string) (result Assignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsVMSSClient.Delete") + 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.AssignmentsVMSSClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, vmssName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AssignmentsVMSSClient) DeletePreparer(ctx context.Context, resourceGroupName string, vmssName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmssName": autorest.Encode("path", vmssName), + } + + const APIVersion = "2022-01-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/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}", 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 AssignmentsVMSSClient) 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 AssignmentsVMSSClient) DeleteResponder(resp *http.Response) (result Assignment, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get get information about a guest configuration assignment for VMSS +// Parameters: +// resourceGroupName - the resource group name. +// vmssName - the name of the virtual machine scale set. +// name - the guest configuration assignment name. +func (client AssignmentsVMSSClient) Get(ctx context.Context, resourceGroupName string, vmssName string, name string) (result Assignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsVMSSClient.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.AssignmentsVMSSClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, vmssName, name) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "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.AssignmentsVMSSClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AssignmentsVMSSClient) GetPreparer(ctx context.Context, resourceGroupName string, vmssName string, name string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmssName": autorest.Encode("path", vmssName), + } + + const APIVersion = "2022-01-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/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}", 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 AssignmentsVMSSClient) 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 AssignmentsVMSSClient) 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 VMSS. +// Parameters: +// resourceGroupName - the resource group name. +// vmssName - the name of the virtual machine scale set. +func (client AssignmentsVMSSClient) List(ctx context.Context, resourceGroupName string, vmssName string) (result AssignmentList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AssignmentsVMSSClient.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.AssignmentsVMSSClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx, resourceGroupName, vmssName) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "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.AssignmentsVMSSClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "guestconfiguration.AssignmentsVMSSClient", "List", resp, "Failure responding to request") + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AssignmentsVMSSClient) ListPreparer(ctx context.Context, resourceGroupName string, vmssName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "vmssName": autorest.Encode("path", vmssName), + } + + const APIVersion = "2022-01-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/virtualMachineScaleSets/{vmssName}/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 AssignmentsVMSSClient) 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 AssignmentsVMSSClient) 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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/client.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/client.go new file mode 100644 index 000000000000..ee25c09c38b6 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/client.go @@ -0,0 +1,41 @@ +// Package guestconfiguration implements the Azure ARM Guestconfiguration service API version 2022-01-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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/enums.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/enums.go new file mode 100644 index 000000000000..4fd934ae7e4d --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/enums.go @@ -0,0 +1,141 @@ +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 ( + // ContinueConfiguration ... + ContinueConfiguration ActionAfterReboot = "ContinueConfiguration" + // StopConfiguration ... + StopConfiguration ActionAfterReboot = "StopConfiguration" +) + +// PossibleActionAfterRebootValues returns an array of possible values for the ActionAfterReboot const type. +func PossibleActionAfterRebootValues() []ActionAfterReboot { + return []ActionAfterReboot{ContinueConfiguration, StopConfiguration} +} + +// AssignmentType enumerates the values for assignment type. +type AssignmentType string + +const ( + // ApplyAndAutoCorrect ... + ApplyAndAutoCorrect AssignmentType = "ApplyAndAutoCorrect" + // ApplyAndMonitor ... + ApplyAndMonitor AssignmentType = "ApplyAndMonitor" + // Audit ... + Audit AssignmentType = "Audit" + // DeployAndAutoCorrect ... + DeployAndAutoCorrect AssignmentType = "DeployAndAutoCorrect" +) + +// PossibleAssignmentTypeValues returns an array of possible values for the AssignmentType const type. +func PossibleAssignmentTypeValues() []AssignmentType { + return []AssignmentType{ApplyAndAutoCorrect, ApplyAndMonitor, Audit, DeployAndAutoCorrect} +} + +// ComplianceStatus enumerates the values for compliance status. +type ComplianceStatus string + +const ( + // Compliant ... + Compliant ComplianceStatus = "Compliant" + // NonCompliant ... + NonCompliant ComplianceStatus = "NonCompliant" + // Pending ... + Pending ComplianceStatus = "Pending" +) + +// PossibleComplianceStatusValues returns an array of possible values for the ComplianceStatus const type. +func PossibleComplianceStatusValues() []ComplianceStatus { + return []ComplianceStatus{Compliant, NonCompliant, Pending} +} + +// 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} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // Application ... + Application CreatedByType = "Application" + // Key ... + Key CreatedByType = "Key" + // ManagedIdentity ... + ManagedIdentity CreatedByType = "ManagedIdentity" + // User ... + User CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{Application, Key, ManagedIdentity, User} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // DSC ... + DSC Kind = "DSC" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{DSC} +} + +// ProvisioningState enumerates the values for provisioning state. +type ProvisioningState string + +const ( + // Canceled ... + Canceled ProvisioningState = "Canceled" + // Created ... + Created ProvisioningState = "Created" + // Failed ... + Failed ProvisioningState = "Failed" + // Succeeded ... + Succeeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{Canceled, Created, Failed, Succeeded} +} + +// Type enumerates the values for type. +type Type string + +const ( + // Consistency ... + Consistency Type = "Consistency" + // Initial ... + Initial Type = "Initial" +) + +// PossibleTypeValues returns an array of possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{Consistency, Initial} +} diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/guestconfigurationapi/interfaces.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/guestconfigurationapi/interfaces.go new file mode 100644 index 000000000000..1c862dbec953 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/guestconfigurationapi/interfaces.go @@ -0,0 +1,75 @@ +package guestconfigurationapi + +// 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/azure-sdk-for-go/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration" + "github.com/Azure/go-autorest/autorest" +) + +// AssignmentsClientAPI contains the set of methods on the AssignmentsClient type. +type AssignmentsClientAPI interface { + CreateOrUpdate(ctx context.Context, guestConfigurationAssignmentName string, parameters guestconfiguration.Assignment, resourceGroupName string, VMName string) (result guestconfiguration.Assignment, err error) + Delete(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result guestconfiguration.Assignment, err error) + List(ctx context.Context, resourceGroupName string, VMName string) (result guestconfiguration.AssignmentList, err error) + RGList(ctx context.Context, resourceGroupName string) (result guestconfiguration.AssignmentList, err error) + SubscriptionList(ctx context.Context) (result guestconfiguration.AssignmentList, err error) +} + +var _ AssignmentsClientAPI = (*guestconfiguration.AssignmentsClient)(nil) + +// AssignmentReportsClientAPI contains the set of methods on the AssignmentReportsClient type. +type AssignmentReportsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, reportID string, VMName string) (result guestconfiguration.AssignmentReportType, err error) + List(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, VMName string) (result guestconfiguration.AssignmentReportList, err error) +} + +var _ AssignmentReportsClientAPI = (*guestconfiguration.AssignmentReportsClient)(nil) + +// HCRPAssignmentsClientAPI contains the set of methods on the HCRPAssignmentsClient type. +type HCRPAssignmentsClientAPI interface { + CreateOrUpdate(ctx context.Context, guestConfigurationAssignmentName string, parameters guestconfiguration.Assignment, resourceGroupName string, machineName string) (result guestconfiguration.Assignment, err error) + Delete(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (result guestconfiguration.Assignment, err error) + List(ctx context.Context, resourceGroupName string, machineName string) (result guestconfiguration.AssignmentList, err error) +} + +var _ HCRPAssignmentsClientAPI = (*guestconfiguration.HCRPAssignmentsClient)(nil) + +// HCRPAssignmentReportsClientAPI contains the set of methods on the HCRPAssignmentReportsClient type. +type HCRPAssignmentReportsClientAPI interface { + Get(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, reportID string, machineName string) (result guestconfiguration.AssignmentReportType, err error) + List(ctx context.Context, resourceGroupName string, guestConfigurationAssignmentName string, machineName string) (result guestconfiguration.AssignmentReportList, err error) +} + +var _ HCRPAssignmentReportsClientAPI = (*guestconfiguration.HCRPAssignmentReportsClient)(nil) + +// AssignmentsVMSSClientAPI contains the set of methods on the AssignmentsVMSSClient type. +type AssignmentsVMSSClientAPI interface { + Delete(ctx context.Context, resourceGroupName string, vmssName string, name string) (result guestconfiguration.Assignment, err error) + Get(ctx context.Context, resourceGroupName string, vmssName string, name string) (result guestconfiguration.Assignment, err error) + List(ctx context.Context, resourceGroupName string, vmssName string) (result guestconfiguration.AssignmentList, err error) +} + +var _ AssignmentsVMSSClientAPI = (*guestconfiguration.AssignmentsVMSSClient)(nil) + +// AssignmentReportsVMSSClientAPI contains the set of methods on the AssignmentReportsVMSSClient type. +type AssignmentReportsVMSSClientAPI interface { + Get(ctx context.Context, resourceGroupName string, vmssName string, name string, ID string) (result guestconfiguration.AssignmentReportType, err error) + List(ctx context.Context, resourceGroupName string, vmssName string, name string) (result guestconfiguration.AssignmentReportList, err error) +} + +var _ AssignmentReportsVMSSClientAPI = (*guestconfiguration.AssignmentReportsVMSSClient)(nil) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result guestconfiguration.OperationList, err error) +} + +var _ OperationsClientAPI = (*guestconfiguration.OperationsClient)(nil) diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/hcrpassignmentreports.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/hcrpassignmentreports.go new file mode 100644 index 000000000000..46c2fd080674 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/hcrpassignmentreports.go @@ -0,0 +1,203 @@ +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 = "2022-01-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 = "2022-01-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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/hcrpassignments.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/hcrpassignments.go new file mode 100644 index 000000000000..635f26abaa88 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/hcrpassignments.go @@ -0,0 +1,369 @@ +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 = "2022-01-25" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + parameters.SystemData = nil + 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 = "2022-01-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 = "2022-01-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 = "2022-01-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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/models.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/models.go new file mode 100644 index 000000000000..7ed2403d34b1 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/models.go @@ -0,0 +1,614 @@ +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/2022-01-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"` + // SystemData - READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,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: 'Compliant', 'NonCompliant', 'Pending' + 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"` + // ParameterHash - READ-ONLY; parameter hash for the guest configuration assignment. + ParameterHash *string `json:"parameterHash,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: 'Succeeded', 'Failed', 'Canceled', 'Created' + ProvisioningState ProvisioningState `json:"provisioningState,omitempty"` + // ResourceType - READ-ONLY; Type of the resource - VMSS / VM + ResourceType *string `json:"resourceType,omitempty"` + // VmssVMList - The list of VM Compliance data for VMSS + VmssVMList *[]VMSSVMInfo `json:"vmssVMList,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 + } + if ap.VmssVMList != nil { + objectMap["vmssVMList"] = ap.VmssVMList + } + 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: 'Compliant', 'NonCompliant', 'Pending' + ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` + // OperationType - READ-ONLY; Type of report, Consistency or Initial. Possible values include: 'Consistency', 'Initial' + 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: 'Compliant', 'NonCompliant', 'Pending' + 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: 'Consistency', 'Initial' + 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: 'Compliant', 'NonCompliant', 'Pending' + 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"` + // VmssResourceID - READ-ONLY; Azure resource Id of the VMSS. + VmssResourceID *string `json:"vmssResourceId,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: 'Compliant', 'NonCompliant', 'Pending' + 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 - READ-ONLY; 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 - READ-ONLY; 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 - READ-ONLY; Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration. Possible values include: 'ContinueConfiguration', 'StopConfiguration' + ActionAfterReboot ActionAfterReboot `json:"actionAfterReboot,omitempty"` + // RefreshFrequencyMins - READ-ONLY; 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 - READ-ONLY; 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 - READ-ONLY; 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"` +} + +// MarshalJSON is the custom marshaler for ConfigurationSetting. +func (cs ConfigurationSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// 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: 'DSC' + 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: 'Audit', 'DeployAndAutoCorrect', 'ApplyAndAutoCorrect', 'ApplyAndMonitor' + AssignmentType AssignmentType `json:"assignmentType,omitempty"` + // AssignmentSource - READ-ONLY; Specifies the origin of the configuration. + AssignmentSource *string `json:"assignmentSource,omitempty"` + // ContentType - READ-ONLY; Specifies the content type of the configuration. Possible values could be Builtin or Custom. + ContentType *string `json:"contentType,omitempty"` + // ConfigurationParameter - The configuration parameters for the guest configuration. + ConfigurationParameter *[]ConfigurationParameter `json:"configurationParameter,omitempty"` + // ConfigurationProtectedParameter - The protected configuration parameters for the guest configuration. + ConfigurationProtectedParameter *[]ConfigurationParameter `json:"configurationProtectedParameter,omitempty"` + // ConfigurationSetting - READ-ONLY; The configuration setting for the guest configuration. + ConfigurationSetting *ConfigurationSetting `json:"configurationSetting,omitempty"` +} + +// MarshalJSON is the custom marshaler for Navigation. +func (n Navigation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if n.Kind != "" { + objectMap["kind"] = n.Kind + } + if n.Name != nil { + objectMap["name"] = n.Name + } + if n.Version != nil { + objectMap["version"] = n.Version + } + if n.ContentURI != nil { + objectMap["contentUri"] = n.ContentURI + } + if n.ContentHash != nil { + objectMap["contentHash"] = n.ContentHash + } + if n.AssignmentType != "" { + objectMap["assignmentType"] = n.AssignmentType + } + if n.ConfigurationParameter != nil { + objectMap["configurationParameter"] = n.ConfigurationParameter + } + if n.ConfigurationProtectedParameter != nil { + objectMap["configurationProtectedParameter"] = n.ConfigurationProtectedParameter + } + return json.Marshal(objectMap) +} + +// 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) +} + +// SystemData metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // CreatedBy - The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + // CreatedByType - The type of identity that created the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + CreatedByType CreatedByType `json:"createdByType,omitempty"` + // CreatedAt - The timestamp of resource creation (UTC). + CreatedAt *date.Time `json:"createdAt,omitempty"` + // LastModifiedBy - The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'User', 'Application', 'ManagedIdentity', 'Key' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The timestamp of resource last modification (UTC) + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// 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) +} + +// VMSSVMInfo information about VMSS VM +type VMSSVMInfo struct { + // VMID - READ-ONLY; UUID of the VM. + VMID *string `json:"vmId,omitempty"` + // VMResourceID - READ-ONLY; Azure resource Id of the VM. + VMResourceID *string `json:"vmResourceId,omitempty"` + // ComplianceStatus - READ-ONLY; A value indicating compliance status of the machine for the assigned guest configuration. Possible values include: 'Compliant', 'NonCompliant', 'Pending' + ComplianceStatus ComplianceStatus `json:"complianceStatus,omitempty"` + // LatestReportID - READ-ONLY; Id of the latest report for the guest configuration assignment. + LatestReportID *string `json:"latestReportId,omitempty"` + // LastComplianceChecked - READ-ONLY; Date and time when last compliance status was checked. + LastComplianceChecked *date.Time `json:"lastComplianceChecked,omitempty"` +} + +// MarshalJSON is the custom marshaler for VMSSVMInfo. +func (vi VMSSVMInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} diff --git a/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/operations.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/operations.go new file mode 100644 index 000000000000..babadbfebc03 --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/operations.go @@ -0,0 +1,98 @@ +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 = "2022-01-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/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/version.go b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/version.go new file mode 100644 index 000000000000..24b57c678baf --- /dev/null +++ b/services/guestconfiguration/mgmt/2022-01-25/guestconfiguration/version.go @@ -0,0 +1,19 @@ +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/2022-01-25" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}