From 0da3b1ee5594e913c695e2ebe3bdd25df9629679 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sat, 2 May 2020 09:31:09 +0000 Subject: [PATCH] Generated from d2f4ab07caf7d3fca8958461cfe367dbe212fc5c deleting another readonly property from the example --- .../security/adaptiveapplicationcontrols.go | 80 +++++++++++++++++++ .../security/informationprotectionpolicies.go | 9 ++- .../security/mgmt/v1.0/security/models.go | 33 +++++++- .../v1.0/security/securityapi/interfaces.go | 3 +- .../security/mgmt/v1.0/security/version.go | 2 +- 5 files changed, 120 insertions(+), 7 deletions(-) diff --git a/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go b/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go index 3539525c7196..3c6bb4585652 100644 --- a/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go +++ b/services/preview/security/mgmt/v1.0/security/adaptiveapplicationcontrols.go @@ -43,6 +43,86 @@ func NewAdaptiveApplicationControlsClientWithBaseURI(baseURI string, subscriptio return AdaptiveApplicationControlsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} } +// Delete delete an application control VM/server group +// Parameters: +// groupName - name of an application control VM/server group +func (client AdaptiveApplicationControlsClient) Delete(ctx context.Context, groupName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AdaptiveApplicationControlsClient.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: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.Pattern, Rule: `^[0-9A-Fa-f]{8}-([0-9A-Fa-f]{4}-){3}[0-9A-Fa-f]{12}$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("security.AdaptiveApplicationControlsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, groupName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.AdaptiveApplicationControlsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AdaptiveApplicationControlsClient) DeletePreparer(ctx context.Context, groupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "ascLocation": autorest.Encode("path", client.AscLocation), + "groupName": autorest.Encode("path", groupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-06-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}", 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 AdaptiveApplicationControlsClient) 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 AdaptiveApplicationControlsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + // Get gets an application control VM/server group. // Parameters: // groupName - name of an application control VM/server group diff --git a/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go b/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go index b1ca96db2f94..d2c937c922bd 100644 --- a/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go +++ b/services/preview/security/mgmt/v1.0/security/informationprotectionpolicies.go @@ -47,7 +47,8 @@ func NewInformationProtectionPoliciesClientWithBaseURI(baseURI string, subscript // scope - scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or // management group (/providers/Microsoft.Management/managementGroups/mgName). // informationProtectionPolicyName - name of the information protection policy. -func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string) (result InformationProtectionPolicy, err error) { +// informationProtectionPolicy - information protection policy. +func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string, informationProtectionPolicy InformationProtectionPolicy) (result InformationProtectionPolicy, err error) { if tracing.IsEnabled() { ctx = tracing.StartSpan(ctx, fqdn+"/InformationProtectionPoliciesClient.CreateOrUpdate") defer func() { @@ -58,7 +59,7 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Con tracing.EndSpan(ctx, sc, err) }() } - req, err := client.CreateOrUpdatePreparer(ctx, scope, informationProtectionPolicyName) + req, err := client.CreateOrUpdatePreparer(ctx, scope, informationProtectionPolicyName, informationProtectionPolicy) if err != nil { err = autorest.NewErrorWithError(err, "security.InformationProtectionPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request") return @@ -80,7 +81,7 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Con } // CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client InformationProtectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, scope string, informationProtectionPolicyName string) (*http.Request, error) { +func (client InformationProtectionPoliciesClient) CreateOrUpdatePreparer(ctx context.Context, scope string, informationProtectionPolicyName string, informationProtectionPolicy InformationProtectionPolicy) (*http.Request, error) { pathParameters := map[string]interface{}{ "informationProtectionPolicyName": autorest.Encode("path", informationProtectionPolicyName), "scope": autorest.Encode("path", scope), @@ -92,9 +93,11 @@ func (client InformationProtectionPoliciesClient) CreateOrUpdatePreparer(ctx con } preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), autorest.WithBaseURL(client.BaseURI), autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}", pathParameters), + autorest.WithJSON(informationProtectionPolicy), autorest.WithQueryParameters(queryParameters)) return preparer.Prepare((&http.Request{}).WithContext(ctx)) } diff --git a/services/preview/security/mgmt/v1.0/security/models.go b/services/preview/security/mgmt/v1.0/security/models.go index 3bd892fb46d9..3b1da6e16ad7 100644 --- a/services/preview/security/mgmt/v1.0/security/models.go +++ b/services/preview/security/mgmt/v1.0/security/models.go @@ -540,6 +540,27 @@ func PossibleProtocolValues() []Protocol { return []Protocol{All, TCP, UDP} } +// Rank enumerates the values for rank. +type Rank string + +const ( + // RankCritical ... + RankCritical Rank = "Critical" + // RankHigh ... + RankHigh Rank = "High" + // RankLow ... + RankLow Rank = "Low" + // RankMedium ... + RankMedium Rank = "Medium" + // RankNone ... + RankNone Rank = "None" +) + +// PossibleRankValues returns an array of possible values for the Rank const type. +func PossibleRankValues() []Rank { + return []Rank{RankCritical, RankHigh, RankLow, RankMedium, RankNone} +} + // RecommendationAction enumerates the values for recommendation action. type RecommendationAction string @@ -5277,6 +5298,8 @@ func NewInformationProtectionPolicyListPage(getNextPage func(context.Context, In type InformationProtectionPolicyProperties struct { // LastModifiedUtc - READ-ONLY; Describes the last UTC time the policy was modified. LastModifiedUtc *date.Time `json:"lastModifiedUtc,omitempty"` + // Version - READ-ONLY; Describes the version of the policy. + Version *string `json:"version,omitempty"` // Labels - Dictionary of sensitivity labels. Labels map[string]*SensitivityLabel `json:"labels"` // InformationTypes - The sensitivity information types. @@ -5299,8 +5322,10 @@ func (ippp InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) type InformationType struct { // DisplayName - The name of the information type. DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the information type. + Description *string `json:"description,omitempty"` // Order - The order of the information type. - Order *float64 `json:"order,omitempty"` + Order *int32 `json:"order,omitempty"` // RecommendedLabelID - The recommended label id to be associated with this information type. RecommendedLabelID *uuid.UUID `json:"recommendedLabelId,omitempty"` // Enabled - Indicates whether the information type is enabled or not. @@ -6985,8 +7010,12 @@ type Rule struct { type SensitivityLabel struct { // DisplayName - The name of the sensitivity label. DisplayName *string `json:"displayName,omitempty"` + // Description - The description of the sensitivity label. + Description *string `json:"description,omitempty"` + // Rank - The rank of the sensitivity label. Possible values include: 'RankNone', 'RankLow', 'RankMedium', 'RankHigh', 'RankCritical' + Rank Rank `json:"rank,omitempty"` // Order - The order of the sensitivity label. - Order *float64 `json:"order,omitempty"` + Order *int32 `json:"order,omitempty"` // Enabled - Indicates whether the label is enabled or not. Enabled *bool `json:"enabled,omitempty"` } diff --git a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go index 9c35c4776471..f48976c7fd74 100644 --- a/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v1.0/security/securityapi/interfaces.go @@ -163,7 +163,7 @@ var _ SettingsClientAPI = (*security.SettingsClient)(nil) // InformationProtectionPoliciesClientAPI contains the set of methods on the InformationProtectionPoliciesClient type. type InformationProtectionPoliciesClientAPI interface { - CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string) (result security.InformationProtectionPolicy, err error) + CreateOrUpdate(ctx context.Context, scope string, informationProtectionPolicyName string, informationProtectionPolicy security.InformationProtectionPolicy) (result security.InformationProtectionPolicy, err error) Get(ctx context.Context, scope string, informationProtectionPolicyName string) (result security.InformationProtectionPolicy, err error) List(ctx context.Context, scope string) (result security.InformationProtectionPolicyListPage, err error) ListComplete(ctx context.Context, scope string) (result security.InformationProtectionPolicyListIterator, err error) @@ -255,6 +255,7 @@ var _ JitNetworkAccessPoliciesClientAPI = (*security.JitNetworkAccessPoliciesCli // AdaptiveApplicationControlsClientAPI contains the set of methods on the AdaptiveApplicationControlsClient type. type AdaptiveApplicationControlsClientAPI interface { + Delete(ctx context.Context, groupName string) (result autorest.Response, err error) Get(ctx context.Context, groupName string) (result security.AppWhitelistingGroup, err error) List(ctx context.Context, includePathRecommendations *bool, summary *bool) (result security.AppWhitelistingGroups, err error) Put(ctx context.Context, groupName string, body security.AppWhitelistingPutGroupData) (result security.AppWhitelistingGroup, err error) diff --git a/services/preview/security/mgmt/v1.0/security/version.go b/services/preview/security/mgmt/v1.0/security/version.go index 700532fb79c7..f4e685baba51 100644 --- a/services/preview/security/mgmt/v1.0/security/version.go +++ b/services/preview/security/mgmt/v1.0/security/version.go @@ -21,7 +21,7 @@ import "github.com/Azure/azure-sdk-for-go/version" // UserAgent returns the UserAgent string to use when sending http.Requests. func UserAgent() string { - return "Azure-SDK-For-Go/" + version.Number + " security/v1.0" + return "Azure-SDK-For-Go/" + Version() + " security/v1.0" } // Version returns the semantic version (see http://semver.org) of the client.