diff --git a/services/preview/security/mgmt/v3.0/security/enums.go b/services/preview/security/mgmt/v3.0/security/enums.go index f5703d67f45c..0a6e85639980 100644 --- a/services/preview/security/mgmt/v3.0/security/enums.go +++ b/services/preview/security/mgmt/v3.0/security/enums.go @@ -1399,3 +1399,18 @@ const ( func PossibleValueTypeValues() []ValueType { return []ValueType{ValueTypeIPCidr, ValueTypeString} } + +// VersionKind enumerates the values for version kind. +type VersionKind string + +const ( + // Latest ... + Latest VersionKind = "Latest" + // Previous ... + Previous VersionKind = "Previous" +) + +// PossibleVersionKindValues returns an array of possible values for the VersionKind const type. +func PossibleVersionKindValues() []VersionKind { + return []VersionKind{Latest, Previous} +} diff --git a/services/preview/security/mgmt/v3.0/security/iotdefendersettings.go b/services/preview/security/mgmt/v3.0/security/iotdefendersettings.go new file mode 100644 index 000000000000..8a5b93a000cf --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotdefendersettings.go @@ -0,0 +1,423 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" +) + +// IotDefenderSettingsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IotDefenderSettingsClient struct { + BaseClient +} + +// NewIotDefenderSettingsClient creates an instance of the IotDefenderSettingsClient client. +func NewIotDefenderSettingsClient(subscriptionID string, ascLocation string) IotDefenderSettingsClient { + return NewIotDefenderSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIotDefenderSettingsClientWithBaseURI creates an instance of the IotDefenderSettingsClient 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 NewIotDefenderSettingsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotDefenderSettingsClient { + return IotDefenderSettingsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate create or update IoT Defender settings +func (client IotDefenderSettingsClient) CreateOrUpdate(ctx context.Context) (result IotDefenderSettingsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotDefenderSettingsClient.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: 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.IotDefenderSettingsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IotDefenderSettingsClient) CreateOrUpdatePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default", pathParameters), + 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 IotDefenderSettingsClient) 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 IotDefenderSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result IotDefenderSettingsModel, 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 IoT Defender settings +func (client IotDefenderSettingsClient) Delete(ctx context.Context) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotDefenderSettingsClient.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.IotDefenderSettingsClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IotDefenderSettingsClient) DeletePreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default", 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 IotDefenderSettingsClient) 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 IotDefenderSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get IoT Defender Settings +func (client IotDefenderSettingsClient) Get(ctx context.Context) (result IotDefenderSettingsModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotDefenderSettingsClient.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: 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.IotDefenderSettingsClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IotDefenderSettingsClient) GetPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default", 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 IotDefenderSettingsClient) 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 IotDefenderSettingsClient) GetResponder(resp *http.Response) (result IotDefenderSettingsModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list IoT Defender Settings +func (client IotDefenderSettingsClient) List(ctx context.Context) (result IotDefenderSettingsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotDefenderSettingsClient.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: 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.IotDefenderSettingsClient", "List", err.Error()) + } + + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IotDefenderSettingsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings", 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 IotDefenderSettingsClient) 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 IotDefenderSettingsClient) ListResponder(resp *http.Response) (result IotDefenderSettingsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// PackageDownloadsMethod information about downloadable packages +func (client IotDefenderSettingsClient) PackageDownloadsMethod(ctx context.Context) (result PackageDownloads, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotDefenderSettingsClient.PackageDownloadsMethod") + 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: 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.IotDefenderSettingsClient", "PackageDownloadsMethod", err.Error()) + } + + req, err := client.PackageDownloadsMethodPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "PackageDownloadsMethod", nil, "Failure preparing request") + return + } + + resp, err := client.PackageDownloadsMethodSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "PackageDownloadsMethod", resp, "Failure sending request") + return + } + + result, err = client.PackageDownloadsMethodResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotDefenderSettingsClient", "PackageDownloadsMethod", resp, "Failure responding to request") + } + + return +} + +// PackageDownloadsMethodPreparer prepares the PackageDownloadsMethod request. +func (client IotDefenderSettingsClient) PackageDownloadsMethodPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Security/iotDefenderSettings/default/packageDownloads", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// PackageDownloadsMethodSender sends the PackageDownloadsMethod request. The method will close the +// http.Response Body if it receives an error. +func (client IotDefenderSettingsClient) PackageDownloadsMethodSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// PackageDownloadsMethodResponder handles the response to the PackageDownloadsMethod request. The method always +// closes the http.Response Body. +func (client IotDefenderSettingsClient) PackageDownloadsMethodResponder(resp *http.Response) (result PackageDownloads, 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/preview/security/mgmt/v3.0/security/iotsensors.go b/services/preview/security/mgmt/v3.0/security/iotsensors.go new file mode 100644 index 000000000000..1611c15bd9ab --- /dev/null +++ b/services/preview/security/mgmt/v3.0/security/iotsensors.go @@ -0,0 +1,413 @@ +package security + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// 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" +) + +// IotSensorsClient is the API spec for Microsoft.Security (Azure Security Center) resource provider +type IotSensorsClient struct { + BaseClient +} + +// NewIotSensorsClient creates an instance of the IotSensorsClient client. +func NewIotSensorsClient(subscriptionID string, ascLocation string) IotSensorsClient { + return NewIotSensorsClientWithBaseURI(DefaultBaseURI, subscriptionID, ascLocation) +} + +// NewIotSensorsClientWithBaseURI creates an instance of the IotSensorsClient 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 NewIotSensorsClientWithBaseURI(baseURI string, subscriptionID string, ascLocation string) IotSensorsClient { + return IotSensorsClient{NewWithBaseURI(baseURI, subscriptionID, ascLocation)} +} + +// CreateOrUpdate create or update IoT sensor +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/326b1ffa-8ac7-4034-8437-69bef733dede) or IoT +// Hub (/providers/Microsoft.Devices/iotHubs/myHub) +// iotSensorName - name of the IoT sensor +func (client IotSensorsClient) CreateOrUpdate(ctx context.Context, scope string, iotSensorName string) (result IotSensor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSensorsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, scope, iotSensorName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client IotSensorsClient) CreateOrUpdatePreparer(ctx context.Context, scope string, iotSensorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotSensorName": autorest.Encode("path", iotSensorName), + "scope": scope, + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", pathParameters), + 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 IotSensorsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client IotSensorsClient) CreateOrUpdateResponder(resp *http.Response) (result IotSensor, 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 IoT sensor +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/326b1ffa-8ac7-4034-8437-69bef733dede) or IoT +// Hub (/providers/Microsoft.Devices/iotHubs/myHub) +// iotSensorName - name of the IoT sensor +func (client IotSensorsClient) Delete(ctx context.Context, scope string, iotSensorName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSensorsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, scope, iotSensorName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client IotSensorsClient) DeletePreparer(ctx context.Context, scope string, iotSensorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotSensorName": autorest.Encode("path", iotSensorName), + "scope": scope, + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", 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 IotSensorsClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client IotSensorsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DownloadActivation download sensor activation file +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/326b1ffa-8ac7-4034-8437-69bef733dede) or IoT +// Hub (/providers/Microsoft.Devices/iotHubs/myHub) +// iotSensorName - name of the IoT sensor +func (client IotSensorsClient) DownloadActivation(ctx context.Context, scope string, iotSensorName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSensorsClient.DownloadActivation") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DownloadActivationPreparer(ctx, scope, iotSensorName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "DownloadActivation", nil, "Failure preparing request") + return + } + + resp, err := client.DownloadActivationSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "DownloadActivation", resp, "Failure sending request") + return + } + + result, err = client.DownloadActivationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "DownloadActivation", resp, "Failure responding to request") + } + + return +} + +// DownloadActivationPreparer prepares the DownloadActivation request. +func (client IotSensorsClient) DownloadActivationPreparer(ctx context.Context, scope string, iotSensorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotSensorName": autorest.Encode("path", iotSensorName), + "scope": scope, + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}/downloadActivation", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DownloadActivationSender sends the DownloadActivation request. The method will close the +// http.Response Body if it receives an error. +func (client IotSensorsClient) DownloadActivationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DownloadActivationResponder handles the response to the DownloadActivation request. The method always +// closes the http.Response Body. +func (client IotSensorsClient) DownloadActivationResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get IoT sensor +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/326b1ffa-8ac7-4034-8437-69bef733dede) or IoT +// Hub (/providers/Microsoft.Devices/iotHubs/myHub) +// iotSensorName - name of the IoT sensor +func (client IotSensorsClient) Get(ctx context.Context, scope string, iotSensorName string) (result IotSensor, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSensorsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetPreparer(ctx, scope, iotSensorName) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client IotSensorsClient) GetPreparer(ctx context.Context, scope string, iotSensorName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "iotSensorName": autorest.Encode("path", iotSensorName), + "scope": scope, + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotSensors/{iotSensorName}", 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 IotSensorsClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client IotSensorsClient) GetResponder(resp *http.Response) (result IotSensor, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List list IoT sensors +// Parameters: +// scope - scope of the query, can be subscription (/subscriptions/326b1ffa-8ac7-4034-8437-69bef733dede) or IoT +// Hub (/providers/Microsoft.Devices/iotHubs/myHub) +func (client IotSensorsClient) List(ctx context.Context, scope string) (result IotSensorsList, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/IotSensorsClient.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, scope) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "security.IotSensorsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client IotSensorsClient) ListPreparer(ctx context.Context, scope string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "scope": scope, + } + + const APIVersion = "2020-08-06-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/{scope}/providers/Microsoft.Security/iotSensors", 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 IotSensorsClient) 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 IotSensorsClient) ListResponder(resp *http.Response) (result IotSensorsList, 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/preview/security/mgmt/v3.0/security/models.go b/services/preview/security/mgmt/v3.0/security/models.go index 852b77af86fd..5fc05b4a536b 100644 --- a/services/preview/security/mgmt/v3.0/security/models.go +++ b/services/preview/security/mgmt/v3.0/security/models.go @@ -9772,6 +9772,35 @@ type IotAlertTypeProperties struct { RemediationSteps *[]string `json:"remediationSteps,omitempty"` } +// IotDefenderSettingsList list of IoT Defender settings +type IotDefenderSettingsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List data + Value *[]IotDefenderSettingsModel `json:"value,omitempty"` +} + +// IotDefenderSettingsModel ioT Defender settings +type IotDefenderSettingsModel struct { + autorest.Response `json:"-"` + // Properties - IoT Defender settings properties + Properties interface{} `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotDefenderSettingsModel. +func (idsm IotDefenderSettingsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if idsm.Properties != nil { + objectMap["properties"] = idsm.Properties + } + return json.Marshal(objectMap) +} + // IotRecommendation ioT recommendation type IotRecommendation struct { autorest.Response `json:"-"` @@ -11187,6 +11216,35 @@ func NewIoTSecuritySolutionsListPage(getNextPage func(context.Context, IoTSecuri return IoTSecuritySolutionsListPage{fn: getNextPage} } +// IotSensor ioT sensor +type IotSensor struct { + autorest.Response `json:"-"` + // Properties - IoT sensor properties + Properties interface{} `json:"properties,omitempty"` + // ID - READ-ONLY; Resource Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Resource name + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Resource type + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IotSensor. +func (is IotSensor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if is.Properties != nil { + objectMap["properties"] = is.Properties + } + return json.Marshal(objectMap) +} + +// IotSensorsList list of IoT sensors +type IotSensorsList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List data + Value *[]IotSensor `json:"value,omitempty"` +} + // IoTSeverityMetrics ioT Security solution analytics severity metrics. type IoTSeverityMetrics struct { // High - Count of high severity alerts/recommendations. @@ -12950,6 +13008,115 @@ func NewOperationListPage(getNextPage func(context.Context, OperationList) (Oper return OperationListPage{fn: getNextPage} } +// PackageDownloadInfo information on a specific package download +type PackageDownloadInfo struct { + // Version - READ-ONLY; Version number + Version *string `json:"version,omitempty"` + // Link - Download link + Link *string `json:"link,omitempty"` + // VersionKind - READ-ONLY; Kind of the version. Possible values include: 'Latest', 'Previous' + VersionKind VersionKind `json:"versionKind,omitempty"` +} + +// MarshalJSON is the custom marshaler for PackageDownloadInfo. +func (pdi PackageDownloadInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pdi.Link != nil { + objectMap["link"] = pdi.Link + } + return json.Marshal(objectMap) +} + +// PackageDownloads information about package downloads +type PackageDownloads struct { + autorest.Response `json:"-"` + // Sensor - READ-ONLY; Contains all Sensor binary downloads + Sensor *PackageDownloadsSensor `json:"sensor,omitempty"` + // CentralManager - READ-ONLY; All downloads for Central Manager + CentralManager *PackageDownloadsCentralManager `json:"centralManager,omitempty"` + // ThreatIntelligence - READ-ONLY; All downloads for threat intelligence + ThreatIntelligence *PackageDownloadsThreatIntelligence `json:"threatIntelligence,omitempty"` +} + +// PackageDownloadsCentralManager all downloads for Central Manager +type PackageDownloadsCentralManager struct { + // Full - READ-ONLY; Contains full package downloads + Full *PackageDownloadsCentralManagerFull `json:"full,omitempty"` + // Upgrade - READ-ONLY; Central Manager upgrade package downloads (on existing installations) + Upgrade *[]PackageDownloadInfo `json:"upgrade,omitempty"` +} + +// PackageDownloadsCentralManagerFull contains full package downloads +type PackageDownloadsCentralManagerFull struct { + // Iso - READ-ONLY; Contains all ISO full versions of the Central Manager + Iso *[]PackageDownloadInfo `json:"iso,omitempty"` + // Ovf - READ-ONLY; Contains all OVF (virtual machine) full versions of the Central Manager + Ovf *PackageDownloadsCentralManagerFullOvf `json:"ovf,omitempty"` +} + +// PackageDownloadsCentralManagerFullOvf contains all OVF (virtual machine) full versions of the Central +// Manager +type PackageDownloadsCentralManagerFullOvf struct { + // Enterprise - READ-ONLY; The Enterprise package type + Enterprise *[]PackageDownloadInfo `json:"enterprise,omitempty"` + // EnterpriseHighAvailability - READ-ONLY; The EnterpriseHighAvailability package type + EnterpriseHighAvailability *[]PackageDownloadInfo `json:"enterpriseHighAvailability,omitempty"` + // Medium - READ-ONLY; The Medium package type + Medium *[]PackageDownloadInfo `json:"medium,omitempty"` + // MediumHighAvailability - READ-ONLY; The MediumHighAvailability package type + MediumHighAvailability *[]PackageDownloadInfo `json:"mediumHighAvailability,omitempty"` +} + +// PackageDownloadsSensor contains all Sensor binary downloads +type PackageDownloadsSensor struct { + // Full - READ-ONLY; Contains full package downloads + Full *PackageDownloadsSensorFull `json:"full,omitempty"` + // Upgrade - Sensor upgrade package downloads (on existing installations) + Upgrade *[]PackageDownloadInfo `json:"upgrade,omitempty"` +} + +// MarshalJSON is the custom marshaler for PackageDownloadsSensor. +func (pd PackageDownloadsSensor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.Upgrade != nil { + objectMap["upgrade"] = pd.Upgrade + } + return json.Marshal(objectMap) +} + +// PackageDownloadsSensorFull contains full package downloads +type PackageDownloadsSensorFull struct { + // Iso - READ-ONLY; Contains all ISO full versions for the sensor + Iso *[]PackageDownloadInfo `json:"iso,omitempty"` + // Ovf - Contains all OVF (virtual machine) full versions for the sensor + Ovf *PackageDownloadsSensorFullOvf `json:"ovf,omitempty"` +} + +// MarshalJSON is the custom marshaler for PackageDownloadsSensorFull. +func (pd PackageDownloadsSensorFull) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pd.Ovf != nil { + objectMap["ovf"] = pd.Ovf + } + return json.Marshal(objectMap) +} + +// PackageDownloadsSensorFullOvf contains all OVF (virtual machine) full versions for the sensor +type PackageDownloadsSensorFullOvf struct { + // Enterprise - READ-ONLY; Enterprise package type + Enterprise *[]PackageDownloadInfo `json:"enterprise,omitempty"` + // Medium - READ-ONLY; Medium package type + Medium *[]PackageDownloadInfo `json:"medium,omitempty"` + // Line - READ-ONLY; Line package type + Line *[]PackageDownloadInfo `json:"line,omitempty"` +} + +// PackageDownloadsThreatIntelligence all downloads for threat intelligence +type PackageDownloadsThreatIntelligence struct { + // Link - Download link + Link *string `json:"link,omitempty"` +} + // PathRecommendation represents a path that is recommended to be allowed and its properties type PathRecommendation struct { // Path - The full path of the file, or an identifier of the application @@ -15131,6 +15298,8 @@ type SecureScoreItemProperties struct { DisplayName *string `json:"displayName,omitempty"` // ScoreDetails - READ-ONLY; score object *ScoreDetails `json:"score,omitempty"` + // Weight - READ-ONLY; The weight for calculation of an aggregated score for several scopes + Weight *int64 `json:"weight,omitempty"` } // MarshalJSON is the custom marshaler for SecureScoreItemProperties. @@ -15166,6 +15335,15 @@ func (ssip *SecureScoreItemProperties) UnmarshalJSON(body []byte) error { } ssip.ScoreDetails = &scoreDetails } + case "weight": + if v != nil { + var weight int64 + err = json.Unmarshal(*v, &weight) + if err != nil { + return err + } + ssip.Weight = &weight + } } } diff --git a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go index 24069325f831..71bfcf46564d 100644 --- a/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go +++ b/services/preview/security/mgmt/v3.0/security/securityapi/interfaces.go @@ -487,3 +487,25 @@ type ConnectorsClientAPI interface { } var _ ConnectorsClientAPI = (*security.ConnectorsClient)(nil) + +// IotDefenderSettingsClientAPI contains the set of methods on the IotDefenderSettingsClient type. +type IotDefenderSettingsClientAPI interface { + CreateOrUpdate(ctx context.Context) (result security.IotDefenderSettingsModel, err error) + Delete(ctx context.Context) (result autorest.Response, err error) + Get(ctx context.Context) (result security.IotDefenderSettingsModel, err error) + List(ctx context.Context) (result security.IotDefenderSettingsList, err error) + PackageDownloadsMethod(ctx context.Context) (result security.PackageDownloads, err error) +} + +var _ IotDefenderSettingsClientAPI = (*security.IotDefenderSettingsClient)(nil) + +// IotSensorsClientAPI contains the set of methods on the IotSensorsClient type. +type IotSensorsClientAPI interface { + CreateOrUpdate(ctx context.Context, scope string, iotSensorName string) (result security.IotSensor, err error) + Delete(ctx context.Context, scope string, iotSensorName string) (result autorest.Response, err error) + DownloadActivation(ctx context.Context, scope string, iotSensorName string) (result autorest.Response, err error) + Get(ctx context.Context, scope string, iotSensorName string) (result security.IotSensor, err error) + List(ctx context.Context, scope string) (result security.IotSensorsList, err error) +} + +var _ IotSensorsClientAPI = (*security.IotSensorsClient)(nil)