From 6dc2e1179f0e4dcf2385dff2b46aa4326c9a324b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 13 Jan 2021 01:33:54 +0000 Subject: [PATCH] CodeGen from PR 12350 in Azure/azure-rest-api-specs Swagger preview version(2020-09-01-preview) for Microsoft.DataBoxEdge (#12350) * Copying existing foilder structure for 2020-09-01-preview version * Changes to databoxedge swagger * Modified Example files relative to the swagger file * Add Custom words introduced in swagger * Update readme files * Fix Errors * Fix readme.go error * Address Review changes * Address comments --- .../2020-09-01-preview/databoxedge/addons.go | 440 + .../2020-09-01-preview/databoxedge/alerts.go | 238 + .../databoxedge/availableskus.go | 155 + .../databoxedge/bandwidthschedules.go | 445 + .../2020-09-01-preview/databoxedge/client.go | 52 + .../databoxedge/containers.go | 541 ++ .../databoxedge/databoxedgeapi/interfaces.go | 218 + .../2020-09-01-preview/databoxedge/devices.go | 1475 ++++ .../2020-09-01-preview/databoxedge/enums.go | 1157 +++ .../2020-09-01-preview/databoxedge/jobs.go | 120 + .../2020-09-01-preview/databoxedge/models.go | 7595 +++++++++++++++++ .../databoxedge/monitoringconfig.go | 443 + .../2020-09-01-preview/databoxedge/nodes.go | 160 + .../databoxedge/operations.go | 151 + .../databoxedge/operationsstatus.go | 121 + .../2020-09-01-preview/databoxedge/orders.go | 518 ++ .../2020-09-01-preview/databoxedge/roles.go | 432 + .../2020-09-01-preview/databoxedge/shares.go | 536 ++ .../databoxedge/storageaccountcredentials.go | 444 + .../databoxedge/storageaccounts.go | 439 + .../databoxedge/triggers.go | 436 + .../2020-09-01-preview/databoxedge/users.go | 448 + .../2020-09-01-preview/databoxedge/version.go | 30 + 23 files changed, 16594 insertions(+) create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/addons.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/alerts.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/availableskus.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/bandwidthschedules.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/client.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/containers.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/databoxedgeapi/interfaces.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/devices.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/enums.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/jobs.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/models.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/monitoringconfig.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/nodes.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operations.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operationsstatus.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/orders.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/roles.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/shares.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccountcredentials.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccounts.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/triggers.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/users.go create mode 100644 services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/version.go diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/addons.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/addons.go new file mode 100644 index 000000000000..2dd0ff59efe0 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/addons.go @@ -0,0 +1,440 @@ +package databoxedge + +// 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" +) + +// AddonsClient is the client for the Addons methods of the Databoxedge service. +type AddonsClient struct { + BaseClient +} + +// NewAddonsClient creates an instance of the AddonsClient client. +func NewAddonsClient(subscriptionID string) AddonsClient { + return NewAddonsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAddonsClientWithBaseURI creates an instance of the AddonsClient 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 NewAddonsClientWithBaseURI(baseURI string, subscriptionID string) AddonsClient { + return AddonsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a addon. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// addonName - the addon name. +// addon - the addon properties. +// resourceGroupName - the resource group name. +func (client AddonsClient) CreateOrUpdate(ctx context.Context, deviceName string, roleName string, addonName string, addon BasicAddon, resourceGroupName string) (result AddonsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, roleName, addonName, addon, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client AddonsClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, roleName string, addonName string, addon BasicAddon, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "addonName": autorest.Encode("path", addonName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}", pathParameters), + autorest.WithJSON(addon), + 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 AddonsClient) CreateOrUpdateSender(req *http.Request) (future AddonsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client AddonsClient) (am AddonModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.AddonsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if am.Response.Response, err = future.GetResult(sender); err == nil && am.Response.Response.StatusCode != http.StatusNoContent { + am, err = client.CreateOrUpdateResponder(am.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsCreateOrUpdateFuture", "Result", am.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client AddonsClient) CreateOrUpdateResponder(resp *http.Response) (result AddonModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the addon on the device. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// addonName - the addon name. +// resourceGroupName - the resource group name. +func (client AddonsClient) Delete(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string) (result AddonsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, roleName, addonName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AddonsClient) DeletePreparer(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "addonName": autorest.Encode("path", addonName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}", 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 AddonsClient) DeleteSender(req *http.Request) (future AddonsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client AddonsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.AddonsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AddonsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a specific addon by name. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// addonName - the addon name. +// resourceGroupName - the resource group name. +func (client AddonsClient) Get(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string) (result AddonModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonsClient.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, deviceName, roleName, addonName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AddonsClient) GetPreparer(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "addonName": autorest.Encode("path", addonName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons/{addonName}", 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 AddonsClient) 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 AddonsClient) GetResponder(resp *http.Response) (result AddonModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByRole lists all the addons configured in the role. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// resourceGroupName - the resource group name. +func (client AddonsClient) ListByRole(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result AddonListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonsClient.ListByRole") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByRoleNextResults + req, err := client.ListByRolePreparer(ctx, deviceName, roleName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "ListByRole", nil, "Failure preparing request") + return + } + + resp, err := client.ListByRoleSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "ListByRole", resp, "Failure sending request") + return + } + + result.al, err = client.ListByRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "ListByRole", resp, "Failure responding to request") + return + } + if result.al.hasNextLink() && result.al.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByRolePreparer prepares the ListByRole request. +func (client AddonsClient) ListByRolePreparer(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/addons", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByRoleSender sends the ListByRole request. The method will close the +// http.Response Body if it receives an error. +func (client AddonsClient) ListByRoleSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByRoleResponder handles the response to the ListByRole request. The method always +// closes the http.Response Body. +func (client AddonsClient) ListByRoleResponder(resp *http.Response) (result AddonList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByRoleNextResults retrieves the next set of results, if any. +func (client AddonsClient) listByRoleNextResults(ctx context.Context, lastResults AddonList) (result AddonList, err error) { + req, err := lastResults.addonListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "listByRoleNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByRoleSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "listByRoleNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByRoleResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AddonsClient", "listByRoleNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByRoleComplete enumerates all values, automatically crossing page boundaries as required. +func (client AddonsClient) ListByRoleComplete(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result AddonListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonsClient.ListByRole") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByRole(ctx, deviceName, roleName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/alerts.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/alerts.go new file mode 100644 index 000000000000..4ce7a3856b07 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/alerts.go @@ -0,0 +1,238 @@ +package databoxedge + +// 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" +) + +// AlertsClient is the client for the Alerts methods of the Databoxedge service. +type AlertsClient struct { + BaseClient +} + +// NewAlertsClient creates an instance of the AlertsClient client. +func NewAlertsClient(subscriptionID string) AlertsClient { + return NewAlertsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAlertsClientWithBaseURI creates an instance of the AlertsClient 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 NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient { + return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// name - the alert name. +// resourceGroupName - the resource group name. +func (client AlertsClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result Alert, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client AlertsClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts/{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 AlertsClient) 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 AlertsClient) GetResponder(resp *http.Response) (result Alert, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice gets all the alerts for a Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client AlertsClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result AlertListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.al.Response.Response != nil { + sc = result.al.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.al.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.al, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.al.hasNextLink() && result.al.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client AlertsClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/alerts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client AlertsClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client AlertsClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result AlertList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client AlertsClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults AlertList) (result AlertList, err error) { + req, err := lastResults.alertListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AlertsClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client AlertsClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result AlertListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertsClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/availableskus.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/availableskus.go new file mode 100644 index 000000000000..cea67a2d622a --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/availableskus.go @@ -0,0 +1,155 @@ +package databoxedge + +// 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" +) + +// AvailableSkusClient is the client for the AvailableSkus methods of the Databoxedge service. +type AvailableSkusClient struct { + BaseClient +} + +// NewAvailableSkusClient creates an instance of the AvailableSkusClient client. +func NewAvailableSkusClient(subscriptionID string) AvailableSkusClient { + return NewAvailableSkusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAvailableSkusClientWithBaseURI creates an instance of the AvailableSkusClient 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 NewAvailableSkusClientWithBaseURI(baseURI string, subscriptionID string) AvailableSkusClient { + return AvailableSkusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List sends the list request. +func (client AvailableSkusClient) List(ctx context.Context) (result SkuListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableSkusClient.List") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AvailableSkusClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.AvailableSkusClient", "List", resp, "Failure sending request") + return + } + + result.sl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AvailableSkusClient", "List", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client AvailableSkusClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/availableSkus", 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 AvailableSkusClient) 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 AvailableSkusClient) ListResponder(resp *http.Response) (result SkuList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AvailableSkusClient) listNextResults(ctx context.Context, lastResults SkuList) (result SkuList, err error) { + req, err := lastResults.skuListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.AvailableSkusClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.AvailableSkusClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.AvailableSkusClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AvailableSkusClient) ListComplete(ctx context.Context) (result SkuListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableSkusClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/bandwidthschedules.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/bandwidthschedules.go new file mode 100644 index 000000000000..bd9cc3242792 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/bandwidthschedules.go @@ -0,0 +1,445 @@ +package databoxedge + +// 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" +) + +// BandwidthSchedulesClient is the client for the BandwidthSchedules methods of the Databoxedge service. +type BandwidthSchedulesClient struct { + BaseClient +} + +// NewBandwidthSchedulesClient creates an instance of the BandwidthSchedulesClient client. +func NewBandwidthSchedulesClient(subscriptionID string) BandwidthSchedulesClient { + return NewBandwidthSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewBandwidthSchedulesClientWithBaseURI creates an instance of the BandwidthSchedulesClient 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 NewBandwidthSchedulesClientWithBaseURI(baseURI string, subscriptionID string) BandwidthSchedulesClient { + return BandwidthSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a bandwidth schedule. +// Parameters: +// deviceName - the device name. +// name - the bandwidth schedule name which needs to be added/updated. +// parameters - the bandwidth schedule to be added or updated. +// resourceGroupName - the resource group name. +func (client BandwidthSchedulesClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, parameters BandwidthSchedule, resourceGroupName string) (result BandwidthSchedulesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: parameters, + Constraints: []validation.Constraint{{Target: "parameters.BandwidthScheduleProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.BandwidthScheduleProperties.Start", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BandwidthScheduleProperties.Stop", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BandwidthScheduleProperties.RateInMbps", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "parameters.BandwidthScheduleProperties.Days", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("databoxedge.BandwidthSchedulesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, parameters, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client BandwidthSchedulesClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, parameters BandwidthSchedule, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{name}", 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 BandwidthSchedulesClient) CreateOrUpdateSender(req *http.Request) (future BandwidthSchedulesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client BandwidthSchedulesClient) (bs BandwidthSchedule, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.BandwidthSchedulesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if bs.Response.Response, err = future.GetResult(sender); err == nil && bs.Response.Response.StatusCode != http.StatusNoContent { + bs, err = client.CreateOrUpdateResponder(bs.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesCreateOrUpdateFuture", "Result", bs.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client BandwidthSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result BandwidthSchedule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the specified bandwidth schedule. +// Parameters: +// deviceName - the device name. +// name - the bandwidth schedule name. +// resourceGroupName - the resource group name. +func (client BandwidthSchedulesClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result BandwidthSchedulesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client BandwidthSchedulesClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{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 BandwidthSchedulesClient) DeleteSender(req *http.Request) (future BandwidthSchedulesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client BandwidthSchedulesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.BandwidthSchedulesDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client BandwidthSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified bandwidth schedule. +// Parameters: +// deviceName - the device name. +// name - the bandwidth schedule name. +// resourceGroupName - the resource group name. +func (client BandwidthSchedulesClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result BandwidthSchedule, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client BandwidthSchedulesClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules/{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 BandwidthSchedulesClient) 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 BandwidthSchedulesClient) GetResponder(resp *http.Response) (result BandwidthSchedule, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice gets all the bandwidth schedules for a Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client BandwidthSchedulesClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result BandwidthSchedulesListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.bsl.Response.Response != nil { + sc = result.bsl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.bsl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.bsl, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.bsl.hasNextLink() && result.bsl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client BandwidthSchedulesClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/bandwidthSchedules", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client BandwidthSchedulesClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client BandwidthSchedulesClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result BandwidthSchedulesList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client BandwidthSchedulesClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults BandwidthSchedulesList) (result BandwidthSchedulesList, err error) { + req, err := lastResults.bandwidthSchedulesListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.BandwidthSchedulesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client BandwidthSchedulesClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result BandwidthSchedulesListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/client.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/client.go new file mode 100644 index 000000000000..7767e1c5e037 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/client.go @@ -0,0 +1,52 @@ +// Package databoxedge implements the Azure ARM Databoxedge service API version 2020-09-01-preview. +// +// +package databoxedge + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Databoxedge + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Databoxedge. +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/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/containers.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/containers.go new file mode 100644 index 000000000000..5fb471b48323 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/containers.go @@ -0,0 +1,541 @@ +package databoxedge + +// 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" +) + +// ContainersClient is the client for the Containers methods of the Databoxedge service. +type ContainersClient struct { + BaseClient +} + +// NewContainersClient creates an instance of the ContainersClient client. +func NewContainersClient(subscriptionID string) ContainersClient { + return NewContainersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewContainersClientWithBaseURI creates an instance of the ContainersClient 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 NewContainersClientWithBaseURI(baseURI string, subscriptionID string) ContainersClient { + return ContainersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// deviceName - the device name. +// storageAccountName - the Storage Account Name +// containerName - the container name. +// containerParameter - the container properties. +// resourceGroupName - the resource group name. +func (client ContainersClient) CreateOrUpdate(ctx context.Context, deviceName string, storageAccountName string, containerName string, containerParameter Container, resourceGroupName string) (result ContainersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: containerParameter, + Constraints: []validation.Constraint{{Target: "containerParameter.ContainerProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("databoxedge.ContainersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, storageAccountName, containerName, containerParameter, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client ContainersClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, storageAccountName string, containerName string, containerParameter Container, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}", pathParameters), + autorest.WithJSON(containerParameter), + 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 ContainersClient) CreateOrUpdateSender(req *http.Request) (future ContainersCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client ContainersClient) (c Container, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.ContainersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if c.Response.Response, err = future.GetResult(sender); err == nil && c.Response.Response.StatusCode != http.StatusNoContent { + c, err = client.CreateOrUpdateResponder(c.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersCreateOrUpdateFuture", "Result", c.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client ContainersClient) CreateOrUpdateResponder(resp *http.Response) (result Container, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the container on the Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// storageAccountName - the Storage Account Name +// containerName - the container name. +// resourceGroupName - the resource group name. +func (client ContainersClient) Delete(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (result ContainersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, storageAccountName, containerName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client ContainersClient) DeletePreparer(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}", 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 ContainersClient) DeleteSender(req *http.Request) (future ContainersDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client ContainersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.ContainersDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client ContainersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// storageAccountName - the Storage Account Name +// containerName - the container Name +// resourceGroupName - the resource group name. +func (client ContainersClient) Get(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (result Container, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.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, deviceName, storageAccountName, containerName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client ContainersClient) GetPreparer(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}", 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 ContainersClient) 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 ContainersClient) GetResponder(resp *http.Response) (result Container, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByStorageAccount sends the list by storage account request. +// Parameters: +// deviceName - the device name. +// storageAccountName - the storage Account name. +// resourceGroupName - the resource group name. +func (client ContainersClient) ListByStorageAccount(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result ContainerListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ListByStorageAccount") + defer func() { + sc := -1 + if result.cl.Response.Response != nil { + sc = result.cl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByStorageAccountNextResults + req, err := client.ListByStorageAccountPreparer(ctx, deviceName, storageAccountName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "ListByStorageAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByStorageAccountSender(req) + if err != nil { + result.cl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "ListByStorageAccount", resp, "Failure sending request") + return + } + + result.cl, err = client.ListByStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "ListByStorageAccount", resp, "Failure responding to request") + return + } + if result.cl.hasNextLink() && result.cl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByStorageAccountPreparer prepares the ListByStorageAccount request. +func (client ContainersClient) ListByStorageAccountPreparer(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByStorageAccountSender sends the ListByStorageAccount request. The method will close the +// http.Response Body if it receives an error. +func (client ContainersClient) ListByStorageAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByStorageAccountResponder handles the response to the ListByStorageAccount request. The method always +// closes the http.Response Body. +func (client ContainersClient) ListByStorageAccountResponder(resp *http.Response) (result ContainerList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByStorageAccountNextResults retrieves the next set of results, if any. +func (client ContainersClient) listByStorageAccountNextResults(ctx context.Context, lastResults ContainerList) (result ContainerList, err error) { + req, err := lastResults.containerListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "listByStorageAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByStorageAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "listByStorageAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByStorageAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "listByStorageAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByStorageAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client ContainersClient) ListByStorageAccountComplete(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result ContainerListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.ListByStorageAccount") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByStorageAccount(ctx, deviceName, storageAccountName, resourceGroupName) + return +} + +// Refresh sends the refresh request. +// Parameters: +// deviceName - the device name. +// storageAccountName - the Storage Account Name +// containerName - the container name. +// resourceGroupName - the resource group name. +func (client ContainersClient) Refresh(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (result ContainersRefreshFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainersClient.Refresh") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RefreshPreparer(ctx, deviceName, storageAccountName, containerName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Refresh", nil, "Failure preparing request") + return + } + + result, err = client.RefreshSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersClient", "Refresh", nil, "Failure sending request") + return + } + + return +} + +// RefreshPreparer prepares the Refresh request. +func (client ContainersClient) RefreshPreparer(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "containerName": autorest.Encode("path", containerName), + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}/containers/{containerName}/refresh", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RefreshSender sends the Refresh request. The method will close the +// http.Response Body if it receives an error. +func (client ContainersClient) RefreshSender(req *http.Request) (future ContainersRefreshFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client ContainersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.ContainersRefreshFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.ContainersRefreshFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// RefreshResponder handles the response to the Refresh request. The method always +// closes the http.Response Body. +func (client ContainersClient) RefreshResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/databoxedgeapi/interfaces.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/databoxedgeapi/interfaces.go new file mode 100644 index 000000000000..fc593399a4e4 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/databoxedgeapi/interfaces.go @@ -0,0 +1,218 @@ +package databoxedgeapi + +// 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/azure-sdk-for-go/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge" +) + +// OperationsClientAPI contains the set of methods on the OperationsClient type. +type OperationsClientAPI interface { + List(ctx context.Context) (result databoxedge.OperationsListPage, err error) + ListComplete(ctx context.Context) (result databoxedge.OperationsListIterator, err error) +} + +var _ OperationsClientAPI = (*databoxedge.OperationsClient)(nil) + +// AvailableSkusClientAPI contains the set of methods on the AvailableSkusClient type. +type AvailableSkusClientAPI interface { + List(ctx context.Context) (result databoxedge.SkuListPage, err error) + ListComplete(ctx context.Context) (result databoxedge.SkuListIterator, err error) +} + +var _ AvailableSkusClientAPI = (*databoxedge.AvailableSkusClient)(nil) + +// DevicesClientAPI contains the set of methods on the DevicesClient type. +type DevicesClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, dataBoxEdgeDevice databoxedge.Device, resourceGroupName string) (result databoxedge.DevicesCreateOrUpdateFuture, err error) + CreateOrUpdateSecuritySettings(ctx context.Context, deviceName string, securitySettings databoxedge.SecuritySettings, resourceGroupName string) (result databoxedge.DevicesCreateOrUpdateSecuritySettingsFuture, err error) + Delete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.DevicesDeleteFuture, err error) + DownloadUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.DevicesDownloadUpdatesFuture, err error) + GenerateCertificate(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.GenerateCertResponse, err error) + Get(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.Device, err error) + GetExtendedInformation(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.DeviceExtendedInfo, err error) + GetNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.NetworkSettings, err error) + GetUpdateSummary(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.UpdateSummary, err error) + InstallUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.DevicesInstallUpdatesFuture, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result databoxedge.DeviceListPage, err error) + ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result databoxedge.DeviceListIterator, err error) + ListBySubscription(ctx context.Context, expand string) (result databoxedge.DeviceListPage, err error) + ListBySubscriptionComplete(ctx context.Context, expand string) (result databoxedge.DeviceListIterator, err error) + ScanForUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.DevicesScanForUpdatesFuture, err error) + Update(ctx context.Context, deviceName string, parameters databoxedge.DevicePatch, resourceGroupName string) (result databoxedge.Device, err error) + UpdateExtendedInformation(ctx context.Context, deviceName string, parameters databoxedge.DeviceExtendedInfoPatch, resourceGroupName string) (result databoxedge.DeviceExtendedInfo, err error) + UploadCertificate(ctx context.Context, deviceName string, parameters databoxedge.UploadCertificateRequest, resourceGroupName string) (result databoxedge.UploadCertificateResponse, err error) +} + +var _ DevicesClientAPI = (*databoxedge.DevicesClient)(nil) + +// AlertsClientAPI contains the set of methods on the AlertsClient type. +type AlertsClientAPI interface { + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.Alert, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.AlertListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.AlertListIterator, err error) +} + +var _ AlertsClientAPI = (*databoxedge.AlertsClient)(nil) + +// BandwidthSchedulesClientAPI contains the set of methods on the BandwidthSchedulesClient type. +type BandwidthSchedulesClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, name string, parameters databoxedge.BandwidthSchedule, resourceGroupName string) (result databoxedge.BandwidthSchedulesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.BandwidthSchedulesDeleteFuture, err error) + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.BandwidthSchedule, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.BandwidthSchedulesListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.BandwidthSchedulesListIterator, err error) +} + +var _ BandwidthSchedulesClientAPI = (*databoxedge.BandwidthSchedulesClient)(nil) + +// JobsClientAPI contains the set of methods on the JobsClient type. +type JobsClientAPI interface { + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.Job, err error) +} + +var _ JobsClientAPI = (*databoxedge.JobsClient)(nil) + +// NodesClientAPI contains the set of methods on the NodesClient type. +type NodesClientAPI interface { + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.NodeListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.NodeListIterator, err error) +} + +var _ NodesClientAPI = (*databoxedge.NodesClient)(nil) + +// OperationsStatusClientAPI contains the set of methods on the OperationsStatusClient type. +type OperationsStatusClientAPI interface { + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.Job, err error) +} + +var _ OperationsStatusClientAPI = (*databoxedge.OperationsStatusClient)(nil) + +// OrdersClientAPI contains the set of methods on the OrdersClient type. +type OrdersClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, order databoxedge.Order, resourceGroupName string) (result databoxedge.OrdersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.OrdersDeleteFuture, err error) + Get(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.Order, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.OrderListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.OrderListIterator, err error) + ListDCAccessCode(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.DCAccessCode, err error) +} + +var _ OrdersClientAPI = (*databoxedge.OrdersClient)(nil) + +// RolesClientAPI contains the set of methods on the RolesClient type. +type RolesClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, name string, role databoxedge.BasicRole, resourceGroupName string) (result databoxedge.RolesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.RolesDeleteFuture, err error) + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.RoleModel, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.RoleListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.RoleListIterator, err error) +} + +var _ RolesClientAPI = (*databoxedge.RolesClient)(nil) + +// AddonsClientAPI contains the set of methods on the AddonsClient type. +type AddonsClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, roleName string, addonName string, addon databoxedge.BasicAddon, resourceGroupName string) (result databoxedge.AddonsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string) (result databoxedge.AddonsDeleteFuture, err error) + Get(ctx context.Context, deviceName string, roleName string, addonName string, resourceGroupName string) (result databoxedge.AddonModel, err error) + ListByRole(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result databoxedge.AddonListPage, err error) + ListByRoleComplete(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result databoxedge.AddonListIterator, err error) +} + +var _ AddonsClientAPI = (*databoxedge.AddonsClient)(nil) + +// MonitoringConfigClientAPI contains the set of methods on the MonitoringConfigClient type. +type MonitoringConfigClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, roleName string, monitoringMetricConfiguration databoxedge.MonitoringMetricConfiguration, resourceGroupName string) (result databoxedge.MonitoringConfigCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result databoxedge.MonitoringConfigDeleteFuture, err error) + Get(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result databoxedge.MonitoringMetricConfiguration, err error) + List(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result databoxedge.MonitoringMetricConfigurationListPage, err error) + ListComplete(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result databoxedge.MonitoringMetricConfigurationListIterator, err error) +} + +var _ MonitoringConfigClientAPI = (*databoxedge.MonitoringConfigClient)(nil) + +// SharesClientAPI contains the set of methods on the SharesClient type. +type SharesClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, name string, share databoxedge.Share, resourceGroupName string) (result databoxedge.SharesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.SharesDeleteFuture, err error) + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.Share, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.ShareListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.ShareListIterator, err error) + Refresh(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.SharesRefreshFuture, err error) +} + +var _ SharesClientAPI = (*databoxedge.SharesClient)(nil) + +// StorageAccountCredentialsClientAPI contains the set of methods on the StorageAccountCredentialsClient type. +type StorageAccountCredentialsClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, name string, storageAccountCredential databoxedge.StorageAccountCredential, resourceGroupName string) (result databoxedge.StorageAccountCredentialsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.StorageAccountCredentialsDeleteFuture, err error) + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.StorageAccountCredential, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.StorageAccountCredentialListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.StorageAccountCredentialListIterator, err error) +} + +var _ StorageAccountCredentialsClientAPI = (*databoxedge.StorageAccountCredentialsClient)(nil) + +// StorageAccountsClientAPI contains the set of methods on the StorageAccountsClient type. +type StorageAccountsClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, storageAccountName string, storageAccount databoxedge.StorageAccount, resourceGroupName string) (result databoxedge.StorageAccountsCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result databoxedge.StorageAccountsDeleteFuture, err error) + Get(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result databoxedge.StorageAccount, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.StorageAccountListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result databoxedge.StorageAccountListIterator, err error) +} + +var _ StorageAccountsClientAPI = (*databoxedge.StorageAccountsClient)(nil) + +// ContainersClientAPI contains the set of methods on the ContainersClient type. +type ContainersClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, storageAccountName string, containerName string, containerParameter databoxedge.Container, resourceGroupName string) (result databoxedge.ContainersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (result databoxedge.ContainersDeleteFuture, err error) + Get(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (result databoxedge.Container, err error) + ListByStorageAccount(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result databoxedge.ContainerListPage, err error) + ListByStorageAccountComplete(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result databoxedge.ContainerListIterator, err error) + Refresh(ctx context.Context, deviceName string, storageAccountName string, containerName string, resourceGroupName string) (result databoxedge.ContainersRefreshFuture, err error) +} + +var _ ContainersClientAPI = (*databoxedge.ContainersClient)(nil) + +// TriggersClientAPI contains the set of methods on the TriggersClient type. +type TriggersClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, name string, trigger databoxedge.BasicTrigger, resourceGroupName string) (result databoxedge.TriggersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.TriggersDeleteFuture, err error) + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.TriggerModel, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string, filter string) (result databoxedge.TriggerListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string, filter string) (result databoxedge.TriggerListIterator, err error) +} + +var _ TriggersClientAPI = (*databoxedge.TriggersClient)(nil) + +// UsersClientAPI contains the set of methods on the UsersClient type. +type UsersClientAPI interface { + CreateOrUpdate(ctx context.Context, deviceName string, name string, userParameter databoxedge.User, resourceGroupName string) (result databoxedge.UsersCreateOrUpdateFuture, err error) + Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.UsersDeleteFuture, err error) + Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result databoxedge.User, err error) + ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string, expand string) (result databoxedge.UserListPage, err error) + ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string, expand string) (result databoxedge.UserListIterator, err error) +} + +var _ UsersClientAPI = (*databoxedge.UsersClient)(nil) diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/devices.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/devices.go new file mode 100644 index 000000000000..01867aedab32 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/devices.go @@ -0,0 +1,1475 @@ +package databoxedge + +// 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" +) + +// DevicesClient is the client for the Devices methods of the Databoxedge service. +type DevicesClient struct { + BaseClient +} + +// NewDevicesClient creates an instance of the DevicesClient client. +func NewDevicesClient(subscriptionID string) DevicesClient { + return NewDevicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDevicesClientWithBaseURI creates an instance of the DevicesClient 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 NewDevicesClientWithBaseURI(baseURI string, subscriptionID string) DevicesClient { + return DevicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a Data Box Edge/Data Box Gateway resource. +// Parameters: +// deviceName - the device name. +// dataBoxEdgeDevice - the resource object. +// resourceGroupName - the resource group name. +func (client DevicesClient) CreateOrUpdate(ctx context.Context, deviceName string, dataBoxEdgeDevice Device, resourceGroupName string) (result DevicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: dataBoxEdgeDevice, + Constraints: []validation.Constraint{{Target: "dataBoxEdgeDevice.Location", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("databoxedge.DevicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, dataBoxEdgeDevice, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DevicesClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, dataBoxEdgeDevice Device, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", pathParameters), + autorest.WithJSON(dataBoxEdgeDevice), + 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 DevicesClient) CreateOrUpdateSender(req *http.Request) (future DevicesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client DevicesClient) (d Device, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.DevicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if d.Response.Response, err = future.GetResult(sender); err == nil && d.Response.Response.StatusCode != http.StatusNoContent { + d, err = client.CreateOrUpdateResponder(d.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesCreateOrUpdateFuture", "Result", d.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DevicesClient) CreateOrUpdateResponder(resp *http.Response) (result Device, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// CreateOrUpdateSecuritySettings updates the security settings on a Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// securitySettings - the security settings. +// resourceGroupName - the resource group name. +func (client DevicesClient) CreateOrUpdateSecuritySettings(ctx context.Context, deviceName string, securitySettings SecuritySettings, resourceGroupName string) (result DevicesCreateOrUpdateSecuritySettingsFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.CreateOrUpdateSecuritySettings") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: securitySettings, + Constraints: []validation.Constraint{{Target: "securitySettings.SecuritySettingsProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "securitySettings.SecuritySettingsProperties.DeviceAdminPassword", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "securitySettings.SecuritySettingsProperties.DeviceAdminPassword.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("databoxedge.DevicesClient", "CreateOrUpdateSecuritySettings", err.Error()) + } + + req, err := client.CreateOrUpdateSecuritySettingsPreparer(ctx, deviceName, securitySettings, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdateSecuritySettings", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSecuritySettingsSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "CreateOrUpdateSecuritySettings", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateSecuritySettingsPreparer prepares the CreateOrUpdateSecuritySettings request. +func (client DevicesClient) CreateOrUpdateSecuritySettingsPreparer(ctx context.Context, deviceName string, securitySettings SecuritySettings, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/securitySettings/default/update", pathParameters), + autorest.WithJSON(securitySettings), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSecuritySettingsSender sends the CreateOrUpdateSecuritySettings request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) CreateOrUpdateSecuritySettingsSender(req *http.Request) (future DevicesCreateOrUpdateSecuritySettingsFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client DevicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesCreateOrUpdateSecuritySettingsFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.DevicesCreateOrUpdateSecuritySettingsFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// CreateOrUpdateSecuritySettingsResponder handles the response to the CreateOrUpdateSecuritySettings request. The method always +// closes the http.Response Body. +func (client DevicesClient) CreateOrUpdateSecuritySettingsResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) Delete(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DevicesClient) DeletePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", 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 DevicesClient) DeleteSender(req *http.Request) (future DevicesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client DevicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.DevicesDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DevicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// DownloadUpdates sends the download updates request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) DownloadUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesDownloadUpdatesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.DownloadUpdates") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DownloadUpdatesPreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "DownloadUpdates", nil, "Failure preparing request") + return + } + + result, err = client.DownloadUpdatesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "DownloadUpdates", nil, "Failure sending request") + return + } + + return +} + +// DownloadUpdatesPreparer prepares the DownloadUpdates request. +func (client DevicesClient) DownloadUpdatesPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/downloadUpdates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DownloadUpdatesSender sends the DownloadUpdates request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) DownloadUpdatesSender(req *http.Request) (future DevicesDownloadUpdatesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client DevicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesDownloadUpdatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.DevicesDownloadUpdatesFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DownloadUpdatesResponder handles the response to the DownloadUpdates request. The method always +// closes the http.Response Body. +func (client DevicesClient) DownloadUpdatesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// GenerateCertificate generates certificate for activation key. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) GenerateCertificate(ctx context.Context, deviceName string, resourceGroupName string) (result GenerateCertResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GenerateCertificate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GenerateCertificatePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GenerateCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.GenerateCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GenerateCertificate", resp, "Failure sending request") + return + } + + result, err = client.GenerateCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GenerateCertificate", resp, "Failure responding to request") + return + } + + return +} + +// GenerateCertificatePreparer prepares the GenerateCertificate request. +func (client DevicesClient) GenerateCertificatePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/generateCertificate", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GenerateCertificateSender sends the GenerateCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GenerateCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GenerateCertificateResponder handles the response to the GenerateCertificate request. The method always +// closes the http.Response Body. +func (client DevicesClient) GenerateCertificateResponder(resp *http.Response) (result GenerateCertResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Get gets the properties of the Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) Get(ctx context.Context, deviceName string, resourceGroupName string) (result Device, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.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, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client DevicesClient) GetPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", 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 DevicesClient) 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 DevicesClient) GetResponder(resp *http.Response) (result Device, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetExtendedInformation gets additional information for the specified Azure Stack Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) GetExtendedInformation(ctx context.Context, deviceName string, resourceGroupName string) (result DeviceExtendedInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GetExtendedInformation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetExtendedInformationPreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetExtendedInformation", nil, "Failure preparing request") + return + } + + resp, err := client.GetExtendedInformationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetExtendedInformation", resp, "Failure sending request") + return + } + + result, err = client.GetExtendedInformationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetExtendedInformation", resp, "Failure responding to request") + return + } + + return +} + +// GetExtendedInformationPreparer prepares the GetExtendedInformation request. +func (client DevicesClient) GetExtendedInformationPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/getExtendedInformation", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetExtendedInformationSender sends the GetExtendedInformation request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetExtendedInformationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetExtendedInformationResponder handles the response to the GetExtendedInformation request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetExtendedInformationResponder(resp *http.Response) (result DeviceExtendedInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetNetworkSettings gets the network settings of the specified Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) GetNetworkSettings(ctx context.Context, deviceName string, resourceGroupName string) (result NetworkSettings, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GetNetworkSettings") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetNetworkSettingsPreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetNetworkSettings", nil, "Failure preparing request") + return + } + + resp, err := client.GetNetworkSettingsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetNetworkSettings", resp, "Failure sending request") + return + } + + result, err = client.GetNetworkSettingsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetNetworkSettings", resp, "Failure responding to request") + return + } + + return +} + +// GetNetworkSettingsPreparer prepares the GetNetworkSettings request. +func (client DevicesClient) GetNetworkSettingsPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/networkSettings/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetNetworkSettingsSender sends the GetNetworkSettings request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetNetworkSettingsSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetNetworkSettingsResponder handles the response to the GetNetworkSettings request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetNetworkSettingsResponder(resp *http.Response) (result NetworkSettings, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetUpdateSummary sends the get update summary request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) GetUpdateSummary(ctx context.Context, deviceName string, resourceGroupName string) (result UpdateSummary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.GetUpdateSummary") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetUpdateSummaryPreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetUpdateSummary", nil, "Failure preparing request") + return + } + + resp, err := client.GetUpdateSummarySender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetUpdateSummary", resp, "Failure sending request") + return + } + + result, err = client.GetUpdateSummaryResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "GetUpdateSummary", resp, "Failure responding to request") + return + } + + return +} + +// GetUpdateSummaryPreparer prepares the GetUpdateSummary request. +func (client DevicesClient) GetUpdateSummaryPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateSummary/default", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetUpdateSummarySender sends the GetUpdateSummary request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) GetUpdateSummarySender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetUpdateSummaryResponder handles the response to the GetUpdateSummary request. The method always +// closes the http.Response Body. +func (client DevicesClient) GetUpdateSummaryResponder(resp *http.Response) (result UpdateSummary, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// InstallUpdates sends the install updates request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) InstallUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesInstallUpdatesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.InstallUpdates") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.InstallUpdatesPreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "InstallUpdates", nil, "Failure preparing request") + return + } + + result, err = client.InstallUpdatesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "InstallUpdates", nil, "Failure sending request") + return + } + + return +} + +// InstallUpdatesPreparer prepares the InstallUpdates request. +func (client DevicesClient) InstallUpdatesPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/installUpdates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// InstallUpdatesSender sends the InstallUpdates request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) InstallUpdatesSender(req *http.Request) (future DevicesInstallUpdatesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client DevicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesInstallUpdatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.DevicesInstallUpdatesFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// InstallUpdatesResponder handles the response to the InstallUpdates request. The method always +// closes the http.Response Body. +func (client DevicesClient) InstallUpdatesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// ListByResourceGroup gets all the Data Box Edge/Data Box Gateway devices in a resource group. +// Parameters: +// resourceGroupName - the resource group name. +// expand - specify $expand=details to populate additional fields related to the resource or Specify +// $skipToken= to populate the next page in the list. +func (client DevicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, expand string) (result DeviceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dl.Response.Response != nil { + sc = result.dl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dl, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListByResourceGroup", resp, "Failure responding to request") + return + } + if result.dl.hasNextLink() && result.dl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DevicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListByResourceGroupResponder(resp *http.Response) (result DeviceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DevicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DeviceList) (result DeviceList, err error) { + req, err := lastResults.deviceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DevicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, expand string) (result DeviceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, expand) + return +} + +// ListBySubscription gets all the Data Box Edge/Data Box Gateway devices in a subscription. +// Parameters: +// expand - specify $expand=details to populate additional fields related to the resource or Specify +// $skipToken= to populate the next page in the list. +func (client DevicesClient) ListBySubscription(ctx context.Context, expand string) (result DeviceListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.dl.Response.Response != nil { + sc = result.dl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listBySubscriptionNextResults + req, err := client.ListBySubscriptionPreparer(ctx, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListBySubscription", nil, "Failure preparing request") + return + } + + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.dl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListBySubscription", resp, "Failure sending request") + return + } + + result.dl, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ListBySubscription", resp, "Failure responding to request") + return + } + if result.dl.hasNextLink() && result.dl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListBySubscriptionPreparer prepares the ListBySubscription request. +func (client DevicesClient) ListBySubscriptionPreparer(ctx context.Context, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListBySubscriptionSender sends the ListBySubscription request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always +// closes the http.Response Body. +func (client DevicesClient) ListBySubscriptionResponder(resp *http.Response) (result DeviceList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listBySubscriptionNextResults retrieves the next set of results, if any. +func (client DevicesClient) listBySubscriptionNextResults(ctx context.Context, lastResults DeviceList) (result DeviceList, err error) { + req, err := lastResults.deviceListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListBySubscriptionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") + } + result, err = client.ListBySubscriptionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. +func (client DevicesClient) ListBySubscriptionComplete(ctx context.Context, expand string) (result DeviceListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ListBySubscription") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListBySubscription(ctx, expand) + return +} + +// ScanForUpdates sends the scan for updates request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client DevicesClient) ScanForUpdates(ctx context.Context, deviceName string, resourceGroupName string) (result DevicesScanForUpdatesFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.ScanForUpdates") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ScanForUpdatesPreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ScanForUpdates", nil, "Failure preparing request") + return + } + + result, err = client.ScanForUpdatesSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "ScanForUpdates", nil, "Failure sending request") + return + } + + return +} + +// ScanForUpdatesPreparer prepares the ScanForUpdates request. +func (client DevicesClient) ScanForUpdatesPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/scanForUpdates", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ScanForUpdatesSender sends the ScanForUpdates request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) ScanForUpdatesSender(req *http.Request) (future DevicesScanForUpdatesFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client DevicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesScanForUpdatesFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.DevicesScanForUpdatesFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// ScanForUpdatesResponder handles the response to the ScanForUpdates request. The method always +// closes the http.Response Body. +func (client DevicesClient) ScanForUpdatesResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update modifies a Data Box Edge/Data Box Gateway resource. +// Parameters: +// deviceName - the device name. +// parameters - the resource parameters. +// resourceGroupName - the resource group name. +func (client DevicesClient) Update(ctx context.Context, deviceName string, parameters DevicePatch, resourceGroupName string) (result Device, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdatePreparer(ctx, deviceName, parameters, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DevicesClient) UpdatePreparer(ctx context.Context, deviceName string, parameters DevicePatch, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DevicesClient) UpdateResponder(resp *http.Response) (result Device, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateExtendedInformation gets additional information for the specified Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// parameters - the patch object. +// resourceGroupName - the resource group name. +func (client DevicesClient) UpdateExtendedInformation(ctx context.Context, deviceName string, parameters DeviceExtendedInfoPatch, resourceGroupName string) (result DeviceExtendedInfo, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.UpdateExtendedInformation") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateExtendedInformationPreparer(ctx, deviceName, parameters, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UpdateExtendedInformation", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateExtendedInformationSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UpdateExtendedInformation", resp, "Failure sending request") + return + } + + result, err = client.UpdateExtendedInformationResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UpdateExtendedInformation", resp, "Failure responding to request") + return + } + + return +} + +// UpdateExtendedInformationPreparer prepares the UpdateExtendedInformation request. +func (client DevicesClient) UpdateExtendedInformationPreparer(ctx context.Context, deviceName string, parameters DeviceExtendedInfoPatch, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/updateExtendedInformation", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateExtendedInformationSender sends the UpdateExtendedInformation request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) UpdateExtendedInformationSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateExtendedInformationResponder handles the response to the UpdateExtendedInformation request. The method always +// closes the http.Response Body. +func (client DevicesClient) UpdateExtendedInformationResponder(resp *http.Response) (result DeviceExtendedInfo, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UploadCertificate uploads registration certificate for the device. +// Parameters: +// deviceName - the device name. +// parameters - the upload certificate request. +// resourceGroupName - the resource group name. +func (client DevicesClient) UploadCertificate(ctx context.Context, deviceName string, parameters UploadCertificateRequest, resourceGroupName string) (result UploadCertificateResponse, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DevicesClient.UploadCertificate") + 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: parameters, + Constraints: []validation.Constraint{{Target: "parameters.RawCertificateData", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "parameters.RawCertificateData.Certificate", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("databoxedge.DevicesClient", "UploadCertificate", err.Error()) + } + + req, err := client.UploadCertificatePreparer(ctx, deviceName, parameters, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UploadCertificate", nil, "Failure preparing request") + return + } + + resp, err := client.UploadCertificateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UploadCertificate", resp, "Failure sending request") + return + } + + result, err = client.UploadCertificateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.DevicesClient", "UploadCertificate", resp, "Failure responding to request") + return + } + + return +} + +// UploadCertificatePreparer prepares the UploadCertificate request. +func (client DevicesClient) UploadCertificatePreparer(ctx context.Context, deviceName string, parameters UploadCertificateRequest, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/uploadCertificate", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UploadCertificateSender sends the UploadCertificate request. The method will close the +// http.Response Body if it receives an error. +func (client DevicesClient) UploadCertificateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UploadCertificateResponder handles the response to the UploadCertificate request. The method always +// closes the http.Response Body. +func (client DevicesClient) UploadCertificateResponder(resp *http.Response) (result UploadCertificateResponse, 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/databoxedge/mgmt/2020-09-01-preview/databoxedge/enums.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/enums.go new file mode 100644 index 000000000000..04d0dc32e640 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/enums.go @@ -0,0 +1,1157 @@ +package databoxedge + +// 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. + +// AccountType enumerates the values for account type. +type AccountType string + +const ( + // BlobStorage ... + BlobStorage AccountType = "BlobStorage" + // GeneralPurposeStorage ... + GeneralPurposeStorage AccountType = "GeneralPurposeStorage" +) + +// PossibleAccountTypeValues returns an array of possible values for the AccountType const type. +func PossibleAccountTypeValues() []AccountType { + return []AccountType{BlobStorage, GeneralPurposeStorage} +} + +// AddonState enumerates the values for addon state. +type AddonState string + +const ( + // Created ... + Created AddonState = "Created" + // Creating ... + Creating AddonState = "Creating" + // Deleting ... + Deleting AddonState = "Deleting" + // Failed ... + Failed AddonState = "Failed" + // Invalid ... + Invalid AddonState = "Invalid" + // Reconfiguring ... + Reconfiguring AddonState = "Reconfiguring" + // Updating ... + Updating AddonState = "Updating" +) + +// PossibleAddonStateValues returns an array of possible values for the AddonState const type. +func PossibleAddonStateValues() []AddonState { + return []AddonState{Created, Creating, Deleting, Failed, Invalid, Reconfiguring, Updating} +} + +// AlertSeverity enumerates the values for alert severity. +type AlertSeverity string + +const ( + // Critical ... + Critical AlertSeverity = "Critical" + // Informational ... + Informational AlertSeverity = "Informational" + // Warning ... + Warning AlertSeverity = "Warning" +) + +// PossibleAlertSeverityValues returns an array of possible values for the AlertSeverity const type. +func PossibleAlertSeverityValues() []AlertSeverity { + return []AlertSeverity{Critical, Informational, Warning} +} + +// AuthenticationType enumerates the values for authentication type. +type AuthenticationType string + +const ( + // AuthenticationTypeAzureActiveDirectory ... + AuthenticationTypeAzureActiveDirectory AuthenticationType = "AzureActiveDirectory" + // AuthenticationTypeInvalid ... + AuthenticationTypeInvalid AuthenticationType = "Invalid" +) + +// PossibleAuthenticationTypeValues returns an array of possible values for the AuthenticationType const type. +func PossibleAuthenticationTypeValues() []AuthenticationType { + return []AuthenticationType{AuthenticationTypeAzureActiveDirectory, AuthenticationTypeInvalid} +} + +// AzureContainerDataFormat enumerates the values for azure container data format. +type AzureContainerDataFormat string + +const ( + // AzureFile ... + AzureFile AzureContainerDataFormat = "AzureFile" + // BlockBlob ... + BlockBlob AzureContainerDataFormat = "BlockBlob" + // PageBlob ... + PageBlob AzureContainerDataFormat = "PageBlob" +) + +// PossibleAzureContainerDataFormatValues returns an array of possible values for the AzureContainerDataFormat const type. +func PossibleAzureContainerDataFormatValues() []AzureContainerDataFormat { + return []AzureContainerDataFormat{AzureFile, BlockBlob, PageBlob} +} + +// ClientPermissionType enumerates the values for client permission type. +type ClientPermissionType string + +const ( + // NoAccess ... + NoAccess ClientPermissionType = "NoAccess" + // ReadOnly ... + ReadOnly ClientPermissionType = "ReadOnly" + // ReadWrite ... + ReadWrite ClientPermissionType = "ReadWrite" +) + +// PossibleClientPermissionTypeValues returns an array of possible values for the ClientPermissionType const type. +func PossibleClientPermissionTypeValues() []ClientPermissionType { + return []ClientPermissionType{NoAccess, ReadOnly, ReadWrite} +} + +// ContainerStatus enumerates the values for container status. +type ContainerStatus string + +const ( + // ContainerStatusNeedsAttention ... + ContainerStatusNeedsAttention ContainerStatus = "NeedsAttention" + // ContainerStatusOffline ... + ContainerStatusOffline ContainerStatus = "Offline" + // ContainerStatusOK ... + ContainerStatusOK ContainerStatus = "OK" + // ContainerStatusUnknown ... + ContainerStatusUnknown ContainerStatus = "Unknown" + // ContainerStatusUpdating ... + ContainerStatusUpdating ContainerStatus = "Updating" +) + +// PossibleContainerStatusValues returns an array of possible values for the ContainerStatus const type. +func PossibleContainerStatusValues() []ContainerStatus { + return []ContainerStatus{ContainerStatusNeedsAttention, ContainerStatusOffline, ContainerStatusOK, ContainerStatusUnknown, ContainerStatusUpdating} +} + +// CreatedByType enumerates the values for created by type. +type CreatedByType string + +const ( + // CreatedByTypeApplication ... + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey ... + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity ... + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser ... + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} +} + +// DataPolicy enumerates the values for data policy. +type DataPolicy string + +const ( + // Cloud ... + Cloud DataPolicy = "Cloud" + // Local ... + Local DataPolicy = "Local" +) + +// PossibleDataPolicyValues returns an array of possible values for the DataPolicy const type. +func PossibleDataPolicyValues() []DataPolicy { + return []DataPolicy{Cloud, Local} +} + +// DayOfWeek enumerates the values for day of week. +type DayOfWeek string + +const ( + // Friday ... + Friday DayOfWeek = "Friday" + // Monday ... + Monday DayOfWeek = "Monday" + // Saturday ... + Saturday DayOfWeek = "Saturday" + // Sunday ... + Sunday DayOfWeek = "Sunday" + // Thursday ... + Thursday DayOfWeek = "Thursday" + // Tuesday ... + Tuesday DayOfWeek = "Tuesday" + // Wednesday ... + Wednesday DayOfWeek = "Wednesday" +) + +// PossibleDayOfWeekValues returns an array of possible values for the DayOfWeek const type. +func PossibleDayOfWeekValues() []DayOfWeek { + return []DayOfWeek{Friday, Monday, Saturday, Sunday, Thursday, Tuesday, Wednesday} +} + +// DeviceKind enumerates the values for device kind. +type DeviceKind string + +const ( + // AzureDataBoxGateway ... + AzureDataBoxGateway DeviceKind = "AzureDataBoxGateway" + // AzureModularDataCentre ... + AzureModularDataCentre DeviceKind = "AzureModularDataCentre" + // AzureStackEdge ... + AzureStackEdge DeviceKind = "AzureStackEdge" + // AzureStackHub ... + AzureStackHub DeviceKind = "AzureStackHub" +) + +// PossibleDeviceKindValues returns an array of possible values for the DeviceKind const type. +func PossibleDeviceKindValues() []DeviceKind { + return []DeviceKind{AzureDataBoxGateway, AzureModularDataCentre, AzureStackEdge, AzureStackHub} +} + +// DeviceStatus enumerates the values for device status. +type DeviceStatus string + +const ( + // Disconnected ... + Disconnected DeviceStatus = "Disconnected" + // Maintenance ... + Maintenance DeviceStatus = "Maintenance" + // NeedsAttention ... + NeedsAttention DeviceStatus = "NeedsAttention" + // Offline ... + Offline DeviceStatus = "Offline" + // Online ... + Online DeviceStatus = "Online" + // PartiallyDisconnected ... + PartiallyDisconnected DeviceStatus = "PartiallyDisconnected" + // ReadyToSetup ... + ReadyToSetup DeviceStatus = "ReadyToSetup" +) + +// PossibleDeviceStatusValues returns an array of possible values for the DeviceStatus const type. +func PossibleDeviceStatusValues() []DeviceStatus { + return []DeviceStatus{Disconnected, Maintenance, NeedsAttention, Offline, Online, PartiallyDisconnected, ReadyToSetup} +} + +// DeviceType enumerates the values for device type. +type DeviceType string + +const ( + // DataBoxEdgeDevice ... + DataBoxEdgeDevice DeviceType = "DataBoxEdgeDevice" +) + +// PossibleDeviceTypeValues returns an array of possible values for the DeviceType const type. +func PossibleDeviceTypeValues() []DeviceType { + return []DeviceType{DataBoxEdgeDevice} +} + +// DownloadPhase enumerates the values for download phase. +type DownloadPhase string + +const ( + // Downloading ... + Downloading DownloadPhase = "Downloading" + // Initializing ... + Initializing DownloadPhase = "Initializing" + // Unknown ... + Unknown DownloadPhase = "Unknown" + // Verifying ... + Verifying DownloadPhase = "Verifying" +) + +// PossibleDownloadPhaseValues returns an array of possible values for the DownloadPhase const type. +func PossibleDownloadPhaseValues() []DownloadPhase { + return []DownloadPhase{Downloading, Initializing, Unknown, Verifying} +} + +// EncryptionAlgorithm enumerates the values for encryption algorithm. +type EncryptionAlgorithm string + +const ( + // AES256 ... + AES256 EncryptionAlgorithm = "AES256" + // None ... + None EncryptionAlgorithm = "None" + // RSAESPKCS1V15 ... + RSAESPKCS1V15 EncryptionAlgorithm = "RSAES_PKCS1_v_1_5" +) + +// PossibleEncryptionAlgorithmValues returns an array of possible values for the EncryptionAlgorithm const type. +func PossibleEncryptionAlgorithmValues() []EncryptionAlgorithm { + return []EncryptionAlgorithm{AES256, None, RSAESPKCS1V15} +} + +// HostPlatformType enumerates the values for host platform type. +type HostPlatformType string + +const ( + // KubernetesCluster ... + KubernetesCluster HostPlatformType = "KubernetesCluster" + // LinuxVM ... + LinuxVM HostPlatformType = "LinuxVM" +) + +// PossibleHostPlatformTypeValues returns an array of possible values for the HostPlatformType const type. +func PossibleHostPlatformTypeValues() []HostPlatformType { + return []HostPlatformType{KubernetesCluster, LinuxVM} +} + +// InstallRebootBehavior enumerates the values for install reboot behavior. +type InstallRebootBehavior string + +const ( + // NeverReboots ... + NeverReboots InstallRebootBehavior = "NeverReboots" + // RequestReboot ... + RequestReboot InstallRebootBehavior = "RequestReboot" + // RequiresReboot ... + RequiresReboot InstallRebootBehavior = "RequiresReboot" +) + +// PossibleInstallRebootBehaviorValues returns an array of possible values for the InstallRebootBehavior const type. +func PossibleInstallRebootBehaviorValues() []InstallRebootBehavior { + return []InstallRebootBehavior{NeverReboots, RequestReboot, RequiresReboot} +} + +// JobStatus enumerates the values for job status. +type JobStatus string + +const ( + // JobStatusCanceled ... + JobStatusCanceled JobStatus = "Canceled" + // JobStatusFailed ... + JobStatusFailed JobStatus = "Failed" + // JobStatusInvalid ... + JobStatusInvalid JobStatus = "Invalid" + // JobStatusPaused ... + JobStatusPaused JobStatus = "Paused" + // JobStatusRunning ... + JobStatusRunning JobStatus = "Running" + // JobStatusScheduled ... + JobStatusScheduled JobStatus = "Scheduled" + // JobStatusSucceeded ... + JobStatusSucceeded JobStatus = "Succeeded" +) + +// PossibleJobStatusValues returns an array of possible values for the JobStatus const type. +func PossibleJobStatusValues() []JobStatus { + return []JobStatus{JobStatusCanceled, JobStatusFailed, JobStatusInvalid, JobStatusPaused, JobStatusRunning, JobStatusScheduled, JobStatusSucceeded} +} + +// JobType enumerates the values for job type. +type JobType string + +const ( + // JobTypeBackup ... + JobTypeBackup JobType = "Backup" + // JobTypeDownloadUpdates ... + JobTypeDownloadUpdates JobType = "DownloadUpdates" + // JobTypeInstallUpdates ... + JobTypeInstallUpdates JobType = "InstallUpdates" + // JobTypeInvalid ... + JobTypeInvalid JobType = "Invalid" + // JobTypeRefreshContainer ... + JobTypeRefreshContainer JobType = "RefreshContainer" + // JobTypeRefreshShare ... + JobTypeRefreshShare JobType = "RefreshShare" + // JobTypeRestore ... + JobTypeRestore JobType = "Restore" + // JobTypeScanForUpdates ... + JobTypeScanForUpdates JobType = "ScanForUpdates" + // JobTypeTriggerSupportPackage ... + JobTypeTriggerSupportPackage JobType = "TriggerSupportPackage" +) + +// PossibleJobTypeValues returns an array of possible values for the JobType const type. +func PossibleJobTypeValues() []JobType { + return []JobType{JobTypeBackup, JobTypeDownloadUpdates, JobTypeInstallUpdates, JobTypeInvalid, JobTypeRefreshContainer, JobTypeRefreshShare, JobTypeRestore, JobTypeScanForUpdates, JobTypeTriggerSupportPackage} +} + +// Kind enumerates the values for kind. +type Kind string + +const ( + // KindAddon ... + KindAddon Kind = "Addon" + // KindArcForKubernetes ... + KindArcForKubernetes Kind = "ArcForKubernetes" + // KindIotEdge ... + KindIotEdge Kind = "IotEdge" +) + +// PossibleKindValues returns an array of possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{KindAddon, KindArcForKubernetes, KindIotEdge} +} + +// KindBasicRole enumerates the values for kind basic role. +type KindBasicRole string + +const ( + // KindCloudEdgeManagement ... + KindCloudEdgeManagement KindBasicRole = "CloudEdgeManagement" + // KindIOT ... + KindIOT KindBasicRole = "IOT" + // KindKubernetes ... + KindKubernetes KindBasicRole = "Kubernetes" + // KindMEC ... + KindMEC KindBasicRole = "MEC" + // KindRole ... + KindRole KindBasicRole = "Role" +) + +// PossibleKindBasicRoleValues returns an array of possible values for the KindBasicRole const type. +func PossibleKindBasicRoleValues() []KindBasicRole { + return []KindBasicRole{KindCloudEdgeManagement, KindIOT, KindKubernetes, KindMEC, KindRole} +} + +// KindBasicTrigger enumerates the values for kind basic trigger. +type KindBasicTrigger string + +const ( + // KindFileEvent ... + KindFileEvent KindBasicTrigger = "FileEvent" + // KindPeriodicTimerEvent ... + KindPeriodicTimerEvent KindBasicTrigger = "PeriodicTimerEvent" + // KindTrigger ... + KindTrigger KindBasicTrigger = "Trigger" +) + +// PossibleKindBasicTriggerValues returns an array of possible values for the KindBasicTrigger const type. +func PossibleKindBasicTriggerValues() []KindBasicTrigger { + return []KindBasicTrigger{KindFileEvent, KindPeriodicTimerEvent, KindTrigger} +} + +// KubernetesNodeType enumerates the values for kubernetes node type. +type KubernetesNodeType string + +const ( + // KubernetesNodeTypeInvalid ... + KubernetesNodeTypeInvalid KubernetesNodeType = "Invalid" + // KubernetesNodeTypeMaster ... + KubernetesNodeTypeMaster KubernetesNodeType = "Master" + // KubernetesNodeTypeWorker ... + KubernetesNodeTypeWorker KubernetesNodeType = "Worker" +) + +// PossibleKubernetesNodeTypeValues returns an array of possible values for the KubernetesNodeType const type. +func PossibleKubernetesNodeTypeValues() []KubernetesNodeType { + return []KubernetesNodeType{KubernetesNodeTypeInvalid, KubernetesNodeTypeMaster, KubernetesNodeTypeWorker} +} + +// KubernetesState enumerates the values for kubernetes state. +type KubernetesState string + +const ( + // KubernetesStateCreated ... + KubernetesStateCreated KubernetesState = "Created" + // KubernetesStateCreating ... + KubernetesStateCreating KubernetesState = "Creating" + // KubernetesStateDeleting ... + KubernetesStateDeleting KubernetesState = "Deleting" + // KubernetesStateFailed ... + KubernetesStateFailed KubernetesState = "Failed" + // KubernetesStateInvalid ... + KubernetesStateInvalid KubernetesState = "Invalid" + // KubernetesStateReconfiguring ... + KubernetesStateReconfiguring KubernetesState = "Reconfiguring" + // KubernetesStateUpdating ... + KubernetesStateUpdating KubernetesState = "Updating" +) + +// PossibleKubernetesStateValues returns an array of possible values for the KubernetesState const type. +func PossibleKubernetesStateValues() []KubernetesState { + return []KubernetesState{KubernetesStateCreated, KubernetesStateCreating, KubernetesStateDeleting, KubernetesStateFailed, KubernetesStateInvalid, KubernetesStateReconfiguring, KubernetesStateUpdating} +} + +// MetricAggregationType enumerates the values for metric aggregation type. +type MetricAggregationType string + +const ( + // MetricAggregationTypeAverage ... + MetricAggregationTypeAverage MetricAggregationType = "Average" + // MetricAggregationTypeCount ... + MetricAggregationTypeCount MetricAggregationType = "Count" + // MetricAggregationTypeMaximum ... + MetricAggregationTypeMaximum MetricAggregationType = "Maximum" + // MetricAggregationTypeMinimum ... + MetricAggregationTypeMinimum MetricAggregationType = "Minimum" + // MetricAggregationTypeNone ... + MetricAggregationTypeNone MetricAggregationType = "None" + // MetricAggregationTypeNotSpecified ... + MetricAggregationTypeNotSpecified MetricAggregationType = "NotSpecified" + // MetricAggregationTypeTotal ... + MetricAggregationTypeTotal MetricAggregationType = "Total" +) + +// PossibleMetricAggregationTypeValues returns an array of possible values for the MetricAggregationType const type. +func PossibleMetricAggregationTypeValues() []MetricAggregationType { + return []MetricAggregationType{MetricAggregationTypeAverage, MetricAggregationTypeCount, MetricAggregationTypeMaximum, MetricAggregationTypeMinimum, MetricAggregationTypeNone, MetricAggregationTypeNotSpecified, MetricAggregationTypeTotal} +} + +// MetricCategory enumerates the values for metric category. +type MetricCategory string + +const ( + // Capacity ... + Capacity MetricCategory = "Capacity" + // Transaction ... + Transaction MetricCategory = "Transaction" +) + +// PossibleMetricCategoryValues returns an array of possible values for the MetricCategory const type. +func PossibleMetricCategoryValues() []MetricCategory { + return []MetricCategory{Capacity, Transaction} +} + +// MetricUnit enumerates the values for metric unit. +type MetricUnit string + +const ( + // Bytes ... + Bytes MetricUnit = "Bytes" + // BytesPerSecond ... + BytesPerSecond MetricUnit = "BytesPerSecond" + // Count ... + Count MetricUnit = "Count" + // CountPerSecond ... + CountPerSecond MetricUnit = "CountPerSecond" + // Milliseconds ... + Milliseconds MetricUnit = "Milliseconds" + // NotSpecified ... + NotSpecified MetricUnit = "NotSpecified" + // Percent ... + Percent MetricUnit = "Percent" + // Seconds ... + Seconds MetricUnit = "Seconds" +) + +// PossibleMetricUnitValues returns an array of possible values for the MetricUnit const type. +func PossibleMetricUnitValues() []MetricUnit { + return []MetricUnit{Bytes, BytesPerSecond, Count, CountPerSecond, Milliseconds, NotSpecified, Percent, Seconds} +} + +// MonitoringStatus enumerates the values for monitoring status. +type MonitoringStatus string + +const ( + // Disabled ... + Disabled MonitoringStatus = "Disabled" + // Enabled ... + Enabled MonitoringStatus = "Enabled" +) + +// PossibleMonitoringStatusValues returns an array of possible values for the MonitoringStatus const type. +func PossibleMonitoringStatusValues() []MonitoringStatus { + return []MonitoringStatus{Disabled, Enabled} +} + +// MountType enumerates the values for mount type. +type MountType string + +const ( + // HostPath ... + HostPath MountType = "HostPath" + // Volume ... + Volume MountType = "Volume" +) + +// PossibleMountTypeValues returns an array of possible values for the MountType const type. +func PossibleMountTypeValues() []MountType { + return []MountType{HostPath, Volume} +} + +// MsiIdentityType enumerates the values for msi identity type. +type MsiIdentityType string + +const ( + // MsiIdentityTypeNone ... + MsiIdentityTypeNone MsiIdentityType = "None" + // MsiIdentityTypeSystemAssigned ... + MsiIdentityTypeSystemAssigned MsiIdentityType = "SystemAssigned" + // MsiIdentityTypeUserAssigned ... + MsiIdentityTypeUserAssigned MsiIdentityType = "UserAssigned" +) + +// PossibleMsiIdentityTypeValues returns an array of possible values for the MsiIdentityType const type. +func PossibleMsiIdentityTypeValues() []MsiIdentityType { + return []MsiIdentityType{MsiIdentityTypeNone, MsiIdentityTypeSystemAssigned, MsiIdentityTypeUserAssigned} +} + +// NetworkAdapterDHCPStatus enumerates the values for network adapter dhcp status. +type NetworkAdapterDHCPStatus string + +const ( + // NetworkAdapterDHCPStatusDisabled ... + NetworkAdapterDHCPStatusDisabled NetworkAdapterDHCPStatus = "Disabled" + // NetworkAdapterDHCPStatusEnabled ... + NetworkAdapterDHCPStatusEnabled NetworkAdapterDHCPStatus = "Enabled" +) + +// PossibleNetworkAdapterDHCPStatusValues returns an array of possible values for the NetworkAdapterDHCPStatus const type. +func PossibleNetworkAdapterDHCPStatusValues() []NetworkAdapterDHCPStatus { + return []NetworkAdapterDHCPStatus{NetworkAdapterDHCPStatusDisabled, NetworkAdapterDHCPStatusEnabled} +} + +// NetworkAdapterRDMAStatus enumerates the values for network adapter rdma status. +type NetworkAdapterRDMAStatus string + +const ( + // Capable ... + Capable NetworkAdapterRDMAStatus = "Capable" + // Incapable ... + Incapable NetworkAdapterRDMAStatus = "Incapable" +) + +// PossibleNetworkAdapterRDMAStatusValues returns an array of possible values for the NetworkAdapterRDMAStatus const type. +func PossibleNetworkAdapterRDMAStatusValues() []NetworkAdapterRDMAStatus { + return []NetworkAdapterRDMAStatus{Capable, Incapable} +} + +// NetworkAdapterStatus enumerates the values for network adapter status. +type NetworkAdapterStatus string + +const ( + // Active ... + Active NetworkAdapterStatus = "Active" + // Inactive ... + Inactive NetworkAdapterStatus = "Inactive" +) + +// PossibleNetworkAdapterStatusValues returns an array of possible values for the NetworkAdapterStatus const type. +func PossibleNetworkAdapterStatusValues() []NetworkAdapterStatus { + return []NetworkAdapterStatus{Active, Inactive} +} + +// NetworkGroup enumerates the values for network group. +type NetworkGroup string + +const ( + // NetworkGroupNone ... + NetworkGroupNone NetworkGroup = "None" + // NetworkGroupNonRDMA ... + NetworkGroupNonRDMA NetworkGroup = "NonRDMA" + // NetworkGroupRDMA ... + NetworkGroupRDMA NetworkGroup = "RDMA" +) + +// PossibleNetworkGroupValues returns an array of possible values for the NetworkGroup const type. +func PossibleNetworkGroupValues() []NetworkGroup { + return []NetworkGroup{NetworkGroupNone, NetworkGroupNonRDMA, NetworkGroupRDMA} +} + +// NodeStatus enumerates the values for node status. +type NodeStatus string + +const ( + // NodeStatusDown ... + NodeStatusDown NodeStatus = "Down" + // NodeStatusRebooting ... + NodeStatusRebooting NodeStatus = "Rebooting" + // NodeStatusShuttingDown ... + NodeStatusShuttingDown NodeStatus = "ShuttingDown" + // NodeStatusUnknown ... + NodeStatusUnknown NodeStatus = "Unknown" + // NodeStatusUp ... + NodeStatusUp NodeStatus = "Up" +) + +// PossibleNodeStatusValues returns an array of possible values for the NodeStatus const type. +func PossibleNodeStatusValues() []NodeStatus { + return []NodeStatus{NodeStatusDown, NodeStatusRebooting, NodeStatusShuttingDown, NodeStatusUnknown, NodeStatusUp} +} + +// OrderState enumerates the values for order state. +type OrderState string + +const ( + // Arriving ... + Arriving OrderState = "Arriving" + // AwaitingDrop ... + AwaitingDrop OrderState = "AwaitingDrop" + // AwaitingFulfilment ... + AwaitingFulfilment OrderState = "AwaitingFulfilment" + // AwaitingPickup ... + AwaitingPickup OrderState = "AwaitingPickup" + // AwaitingPreparation ... + AwaitingPreparation OrderState = "AwaitingPreparation" + // AwaitingReturnShipment ... + AwaitingReturnShipment OrderState = "AwaitingReturnShipment" + // AwaitingShipment ... + AwaitingShipment OrderState = "AwaitingShipment" + // CollectedAtMicrosoft ... + CollectedAtMicrosoft OrderState = "CollectedAtMicrosoft" + // Declined ... + Declined OrderState = "Declined" + // Delivered ... + Delivered OrderState = "Delivered" + // LostDevice ... + LostDevice OrderState = "LostDevice" + // PickupCompleted ... + PickupCompleted OrderState = "PickupCompleted" + // ReplacementRequested ... + ReplacementRequested OrderState = "ReplacementRequested" + // ReturnInitiated ... + ReturnInitiated OrderState = "ReturnInitiated" + // Shipped ... + Shipped OrderState = "Shipped" + // ShippedBack ... + ShippedBack OrderState = "ShippedBack" + // Untracked ... + Untracked OrderState = "Untracked" +) + +// PossibleOrderStateValues returns an array of possible values for the OrderState const type. +func PossibleOrderStateValues() []OrderState { + return []OrderState{Arriving, AwaitingDrop, AwaitingFulfilment, AwaitingPickup, AwaitingPreparation, AwaitingReturnShipment, AwaitingShipment, CollectedAtMicrosoft, Declined, Delivered, LostDevice, PickupCompleted, ReplacementRequested, ReturnInitiated, Shipped, ShippedBack, Untracked} +} + +// PlatformType enumerates the values for platform type. +type PlatformType string + +const ( + // Linux ... + Linux PlatformType = "Linux" + // Windows ... + Windows PlatformType = "Windows" +) + +// PossiblePlatformTypeValues returns an array of possible values for the PlatformType const type. +func PossiblePlatformTypeValues() []PlatformType { + return []PlatformType{Linux, Windows} +} + +// PosixComplianceStatus enumerates the values for posix compliance status. +type PosixComplianceStatus string + +const ( + // PosixComplianceStatusDisabled ... + PosixComplianceStatusDisabled PosixComplianceStatus = "Disabled" + // PosixComplianceStatusEnabled ... + PosixComplianceStatusEnabled PosixComplianceStatus = "Enabled" + // PosixComplianceStatusInvalid ... + PosixComplianceStatusInvalid PosixComplianceStatus = "Invalid" +) + +// PossiblePosixComplianceStatusValues returns an array of possible values for the PosixComplianceStatus const type. +func PossiblePosixComplianceStatusValues() []PosixComplianceStatus { + return []PosixComplianceStatus{PosixComplianceStatusDisabled, PosixComplianceStatusEnabled, PosixComplianceStatusInvalid} +} + +// ResourceMoveStatus enumerates the values for resource move status. +type ResourceMoveStatus string + +const ( + // ResourceMoveStatusNone ... + ResourceMoveStatusNone ResourceMoveStatus = "None" + // ResourceMoveStatusResourceMoveFailed ... + ResourceMoveStatusResourceMoveFailed ResourceMoveStatus = "ResourceMoveFailed" + // ResourceMoveStatusResourceMoveInProgress ... + ResourceMoveStatusResourceMoveInProgress ResourceMoveStatus = "ResourceMoveInProgress" +) + +// PossibleResourceMoveStatusValues returns an array of possible values for the ResourceMoveStatus const type. +func PossibleResourceMoveStatusValues() []ResourceMoveStatus { + return []ResourceMoveStatus{ResourceMoveStatusNone, ResourceMoveStatusResourceMoveFailed, ResourceMoveStatusResourceMoveInProgress} +} + +// RoleStatus enumerates the values for role status. +type RoleStatus string + +const ( + // RoleStatusDisabled ... + RoleStatusDisabled RoleStatus = "Disabled" + // RoleStatusEnabled ... + RoleStatusEnabled RoleStatus = "Enabled" +) + +// PossibleRoleStatusValues returns an array of possible values for the RoleStatus const type. +func PossibleRoleStatusValues() []RoleStatus { + return []RoleStatus{RoleStatusDisabled, RoleStatusEnabled} +} + +// RoleTypes enumerates the values for role types. +type RoleTypes string + +const ( + // ASA ... + ASA RoleTypes = "ASA" + // CloudEdgeManagement ... + CloudEdgeManagement RoleTypes = "CloudEdgeManagement" + // Cognitive ... + Cognitive RoleTypes = "Cognitive" + // Functions ... + Functions RoleTypes = "Functions" + // IOT ... + IOT RoleTypes = "IOT" + // Kubernetes ... + Kubernetes RoleTypes = "Kubernetes" + // MEC ... + MEC RoleTypes = "MEC" +) + +// PossibleRoleTypesValues returns an array of possible values for the RoleTypes const type. +func PossibleRoleTypesValues() []RoleTypes { + return []RoleTypes{ASA, CloudEdgeManagement, Cognitive, Functions, IOT, Kubernetes, MEC} +} + +// ShareAccessProtocol enumerates the values for share access protocol. +type ShareAccessProtocol string + +const ( + // NFS ... + NFS ShareAccessProtocol = "NFS" + // SMB ... + SMB ShareAccessProtocol = "SMB" +) + +// PossibleShareAccessProtocolValues returns an array of possible values for the ShareAccessProtocol const type. +func PossibleShareAccessProtocolValues() []ShareAccessProtocol { + return []ShareAccessProtocol{NFS, SMB} +} + +// ShareAccessType enumerates the values for share access type. +type ShareAccessType string + +const ( + // Change ... + Change ShareAccessType = "Change" + // Custom ... + Custom ShareAccessType = "Custom" + // Read ... + Read ShareAccessType = "Read" +) + +// PossibleShareAccessTypeValues returns an array of possible values for the ShareAccessType const type. +func PossibleShareAccessTypeValues() []ShareAccessType { + return []ShareAccessType{Change, Custom, Read} +} + +// ShareStatus enumerates the values for share status. +type ShareStatus string + +const ( + // ShareStatusNeedsAttention ... + ShareStatusNeedsAttention ShareStatus = "NeedsAttention" + // ShareStatusOffline ... + ShareStatusOffline ShareStatus = "Offline" + // ShareStatusOK ... + ShareStatusOK ShareStatus = "OK" + // ShareStatusUnknown ... + ShareStatusUnknown ShareStatus = "Unknown" + // ShareStatusUpdating ... + ShareStatusUpdating ShareStatus = "Updating" +) + +// PossibleShareStatusValues returns an array of possible values for the ShareStatus const type. +func PossibleShareStatusValues() []ShareStatus { + return []ShareStatus{ShareStatusNeedsAttention, ShareStatusOffline, ShareStatusOK, ShareStatusUnknown, ShareStatusUpdating} +} + +// ShipmentType enumerates the values for shipment type. +type ShipmentType string + +const ( + // NotApplicable ... + NotApplicable ShipmentType = "NotApplicable" + // SelfPickup ... + SelfPickup ShipmentType = "SelfPickup" + // ShippedToCustomer ... + ShippedToCustomer ShipmentType = "ShippedToCustomer" +) + +// PossibleShipmentTypeValues returns an array of possible values for the ShipmentType const type. +func PossibleShipmentTypeValues() []ShipmentType { + return []ShipmentType{NotApplicable, SelfPickup, ShippedToCustomer} +} + +// SkuAvailability enumerates the values for sku availability. +type SkuAvailability string + +const ( + // Available ... + Available SkuAvailability = "Available" + // Unavailable ... + Unavailable SkuAvailability = "Unavailable" +) + +// PossibleSkuAvailabilityValues returns an array of possible values for the SkuAvailability const type. +func PossibleSkuAvailabilityValues() []SkuAvailability { + return []SkuAvailability{Available, Unavailable} +} + +// SkuName enumerates the values for sku name. +type SkuName string + +const ( + // Edge ... + Edge SkuName = "Edge" + // EdgeMRMini ... + EdgeMRMini SkuName = "EdgeMR_Mini" + // EdgePBase ... + EdgePBase SkuName = "EdgeP_Base" + // EdgePHigh ... + EdgePHigh SkuName = "EdgeP_High" + // EdgePRBase ... + EdgePRBase SkuName = "EdgePR_Base" + // EdgePRBaseUPS ... + EdgePRBaseUPS SkuName = "EdgePR_Base_UPS" + // Gateway ... + Gateway SkuName = "Gateway" + // GPU ... + GPU SkuName = "GPU" + // RCALarge ... + RCALarge SkuName = "RCA_Large" + // RCASmall ... + RCASmall SkuName = "RCA_Small" + // RDC ... + RDC SkuName = "RDC" + // TCALarge ... + TCALarge SkuName = "TCA_Large" + // TCASmall ... + TCASmall SkuName = "TCA_Small" + // TDC ... + TDC SkuName = "TDC" + // TEA1Node ... + TEA1Node SkuName = "TEA_1Node" + // TEA1NodeHeater ... + TEA1NodeHeater SkuName = "TEA_1Node_Heater" + // TEA1NodeUPS ... + TEA1NodeUPS SkuName = "TEA_1Node_UPS" + // TEA1NodeUPSHeater ... + TEA1NodeUPSHeater SkuName = "TEA_1Node_UPS_Heater" + // TEA4NodeHeater ... + TEA4NodeHeater SkuName = "TEA_4Node_Heater" + // TEA4NodeUPSHeater ... + TEA4NodeUPSHeater SkuName = "TEA_4Node_UPS_Heater" + // TMA ... + TMA SkuName = "TMA" +) + +// PossibleSkuNameValues returns an array of possible values for the SkuName const type. +func PossibleSkuNameValues() []SkuName { + return []SkuName{Edge, EdgeMRMini, EdgePBase, EdgePHigh, EdgePRBase, EdgePRBaseUPS, Gateway, GPU, RCALarge, RCASmall, RDC, TCALarge, TCASmall, TDC, TEA1Node, TEA1NodeHeater, TEA1NodeUPS, TEA1NodeUPSHeater, TEA4NodeHeater, TEA4NodeUPSHeater, TMA} +} + +// SkuSignupOption enumerates the values for sku signup option. +type SkuSignupOption string + +const ( + // SkuSignupOptionAvailable ... + SkuSignupOptionAvailable SkuSignupOption = "Available" + // SkuSignupOptionNone ... + SkuSignupOptionNone SkuSignupOption = "None" +) + +// PossibleSkuSignupOptionValues returns an array of possible values for the SkuSignupOption const type. +func PossibleSkuSignupOptionValues() []SkuSignupOption { + return []SkuSignupOption{SkuSignupOptionAvailable, SkuSignupOptionNone} +} + +// SkuTier enumerates the values for sku tier. +type SkuTier string + +const ( + // Standard ... + Standard SkuTier = "Standard" +) + +// PossibleSkuTierValues returns an array of possible values for the SkuTier const type. +func PossibleSkuTierValues() []SkuTier { + return []SkuTier{Standard} +} + +// SkuVersion enumerates the values for sku version. +type SkuVersion string + +const ( + // Preview ... + Preview SkuVersion = "Preview" + // Stable ... + Stable SkuVersion = "Stable" +) + +// PossibleSkuVersionValues returns an array of possible values for the SkuVersion const type. +func PossibleSkuVersionValues() []SkuVersion { + return []SkuVersion{Preview, Stable} +} + +// SSLStatus enumerates the values for ssl status. +type SSLStatus string + +const ( + // SSLStatusDisabled ... + SSLStatusDisabled SSLStatus = "Disabled" + // SSLStatusEnabled ... + SSLStatusEnabled SSLStatus = "Enabled" +) + +// PossibleSSLStatusValues returns an array of possible values for the SSLStatus const type. +func PossibleSSLStatusValues() []SSLStatus { + return []SSLStatus{SSLStatusDisabled, SSLStatusEnabled} +} + +// StorageAccountStatus enumerates the values for storage account status. +type StorageAccountStatus string + +const ( + // StorageAccountStatusNeedsAttention ... + StorageAccountStatusNeedsAttention StorageAccountStatus = "NeedsAttention" + // StorageAccountStatusOffline ... + StorageAccountStatusOffline StorageAccountStatus = "Offline" + // StorageAccountStatusOK ... + StorageAccountStatusOK StorageAccountStatus = "OK" + // StorageAccountStatusUnknown ... + StorageAccountStatusUnknown StorageAccountStatus = "Unknown" + // StorageAccountStatusUpdating ... + StorageAccountStatusUpdating StorageAccountStatus = "Updating" +) + +// PossibleStorageAccountStatusValues returns an array of possible values for the StorageAccountStatus const type. +func PossibleStorageAccountStatusValues() []StorageAccountStatus { + return []StorageAccountStatus{StorageAccountStatusNeedsAttention, StorageAccountStatusOffline, StorageAccountStatusOK, StorageAccountStatusUnknown, StorageAccountStatusUpdating} +} + +// SubscriptionState enumerates the values for subscription state. +type SubscriptionState string + +const ( + // Deleted ... + Deleted SubscriptionState = "Deleted" + // Registered ... + Registered SubscriptionState = "Registered" + // Suspended ... + Suspended SubscriptionState = "Suspended" + // Unregistered ... + Unregistered SubscriptionState = "Unregistered" + // Warned ... + Warned SubscriptionState = "Warned" +) + +// PossibleSubscriptionStateValues returns an array of possible values for the SubscriptionState const type. +func PossibleSubscriptionStateValues() []SubscriptionState { + return []SubscriptionState{Deleted, Registered, Suspended, Unregistered, Warned} +} + +// TimeGrain enumerates the values for time grain. +type TimeGrain string + +const ( + // PT12H ... + PT12H TimeGrain = "PT12H" + // PT15M ... + PT15M TimeGrain = "PT15M" + // PT1D ... + PT1D TimeGrain = "PT1D" + // PT1H ... + PT1H TimeGrain = "PT1H" + // PT1M ... + PT1M TimeGrain = "PT1M" + // PT30M ... + PT30M TimeGrain = "PT30M" + // PT5M ... + PT5M TimeGrain = "PT5M" + // PT6H ... + PT6H TimeGrain = "PT6H" +) + +// PossibleTimeGrainValues returns an array of possible values for the TimeGrain const type. +func PossibleTimeGrainValues() []TimeGrain { + return []TimeGrain{PT12H, PT15M, PT1D, PT1H, PT1M, PT30M, PT5M, PT6H} +} + +// UpdateOperation enumerates the values for update operation. +type UpdateOperation string + +const ( + // UpdateOperationDownload ... + UpdateOperationDownload UpdateOperation = "Download" + // UpdateOperationInstall ... + UpdateOperationInstall UpdateOperation = "Install" + // UpdateOperationNone ... + UpdateOperationNone UpdateOperation = "None" + // UpdateOperationScan ... + UpdateOperationScan UpdateOperation = "Scan" +) + +// PossibleUpdateOperationValues returns an array of possible values for the UpdateOperation const type. +func PossibleUpdateOperationValues() []UpdateOperation { + return []UpdateOperation{UpdateOperationDownload, UpdateOperationInstall, UpdateOperationNone, UpdateOperationScan} +} + +// UpdateOperationStage enumerates the values for update operation stage. +type UpdateOperationStage string + +const ( + // UpdateOperationStageDownloadComplete ... + UpdateOperationStageDownloadComplete UpdateOperationStage = "DownloadComplete" + // UpdateOperationStageDownloadFailed ... + UpdateOperationStageDownloadFailed UpdateOperationStage = "DownloadFailed" + // UpdateOperationStageDownloadStarted ... + UpdateOperationStageDownloadStarted UpdateOperationStage = "DownloadStarted" + // UpdateOperationStageFailure ... + UpdateOperationStageFailure UpdateOperationStage = "Failure" + // UpdateOperationStageInitial ... + UpdateOperationStageInitial UpdateOperationStage = "Initial" + // UpdateOperationStageInstallComplete ... + UpdateOperationStageInstallComplete UpdateOperationStage = "InstallComplete" + // UpdateOperationStageInstallFailed ... + UpdateOperationStageInstallFailed UpdateOperationStage = "InstallFailed" + // UpdateOperationStageInstallStarted ... + UpdateOperationStageInstallStarted UpdateOperationStage = "InstallStarted" + // UpdateOperationStageRebootInitiated ... + UpdateOperationStageRebootInitiated UpdateOperationStage = "RebootInitiated" + // UpdateOperationStageRescanComplete ... + UpdateOperationStageRescanComplete UpdateOperationStage = "RescanComplete" + // UpdateOperationStageRescanFailed ... + UpdateOperationStageRescanFailed UpdateOperationStage = "RescanFailed" + // UpdateOperationStageRescanStarted ... + UpdateOperationStageRescanStarted UpdateOperationStage = "RescanStarted" + // UpdateOperationStageScanComplete ... + UpdateOperationStageScanComplete UpdateOperationStage = "ScanComplete" + // UpdateOperationStageScanFailed ... + UpdateOperationStageScanFailed UpdateOperationStage = "ScanFailed" + // UpdateOperationStageScanStarted ... + UpdateOperationStageScanStarted UpdateOperationStage = "ScanStarted" + // UpdateOperationStageSuccess ... + UpdateOperationStageSuccess UpdateOperationStage = "Success" + // UpdateOperationStageUnknown ... + UpdateOperationStageUnknown UpdateOperationStage = "Unknown" +) + +// PossibleUpdateOperationStageValues returns an array of possible values for the UpdateOperationStage const type. +func PossibleUpdateOperationStageValues() []UpdateOperationStage { + return []UpdateOperationStage{UpdateOperationStageDownloadComplete, UpdateOperationStageDownloadFailed, UpdateOperationStageDownloadStarted, UpdateOperationStageFailure, UpdateOperationStageInitial, UpdateOperationStageInstallComplete, UpdateOperationStageInstallFailed, UpdateOperationStageInstallStarted, UpdateOperationStageRebootInitiated, UpdateOperationStageRescanComplete, UpdateOperationStageRescanFailed, UpdateOperationStageRescanStarted, UpdateOperationStageScanComplete, UpdateOperationStageScanFailed, UpdateOperationStageScanStarted, UpdateOperationStageSuccess, UpdateOperationStageUnknown} +} + +// UserType enumerates the values for user type. +type UserType string + +const ( + // UserTypeARM ... + UserTypeARM UserType = "ARM" + // UserTypeLocalManagement ... + UserTypeLocalManagement UserType = "LocalManagement" + // UserTypeShare ... + UserTypeShare UserType = "Share" +) + +// PossibleUserTypeValues returns an array of possible values for the UserType const type. +func PossibleUserTypeValues() []UserType { + return []UserType{UserTypeARM, UserTypeLocalManagement, UserTypeShare} +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/jobs.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/jobs.go new file mode 100644 index 000000000000..b6e59a29ca6a --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/jobs.go @@ -0,0 +1,120 @@ +package databoxedge + +// 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" +) + +// JobsClient is the client for the Jobs methods of the Databoxedge service. +type JobsClient struct { + BaseClient +} + +// NewJobsClient creates an instance of the JobsClient client. +func NewJobsClient(subscriptionID string) JobsClient { + return NewJobsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewJobsClientWithBaseURI creates an instance of the JobsClient 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 NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient { + return JobsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// name - the job name. +// resourceGroupName - the resource group name. +func (client JobsClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result Job, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/JobsClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.JobsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.JobsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.JobsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client JobsClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/jobs/{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 JobsClient) 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 JobsClient) GetResponder(resp *http.Response) (result Job, 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/databoxedge/mgmt/2020-09-01-preview/databoxedge/models.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/models.go new file mode 100644 index 000000000000..04824770839f --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/models.go @@ -0,0 +1,7595 @@ +package databoxedge + +// 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" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge" + +// BasicAddon role Addon +type BasicAddon interface { + AsArcAddon() (*ArcAddon, bool) + AsIoTAddon() (*IoTAddon, bool) + AsAddon() (*Addon, bool) +} + +// Addon role Addon +type Addon struct { + autorest.Response `json:"-"` + // SystemData - Addon type + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindAddon', 'KindArcForKubernetes', 'KindIotEdge' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +func unmarshalBasicAddon(body []byte) (BasicAddon, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindArcForKubernetes): + var aa ArcAddon + err := json.Unmarshal(body, &aa) + return aa, err + case string(KindIotEdge): + var ita IoTAddon + err := json.Unmarshal(body, &ita) + return ita, err + default: + var a Addon + err := json.Unmarshal(body, &a) + return a, err + } +} +func unmarshalBasicAddonArray(body []byte) ([]BasicAddon, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + aArray := make([]BasicAddon, len(rawMessages)) + + for index, rawMessage := range rawMessages { + a, err := unmarshalBasicAddon(*rawMessage) + if err != nil { + return nil, err + } + aArray[index] = a + } + return aArray, nil +} + +// MarshalJSON is the custom marshaler for Addon. +func (a Addon) MarshalJSON() ([]byte, error) { + a.Kind = KindAddon + objectMap := make(map[string]interface{}) + if a.SystemData != nil { + objectMap["systemData"] = a.SystemData + } + if a.Kind != "" { + objectMap["kind"] = a.Kind + } + return json.Marshal(objectMap) +} + +// AsArcAddon is the BasicAddon implementation for Addon. +func (a Addon) AsArcAddon() (*ArcAddon, bool) { + return nil, false +} + +// AsIoTAddon is the BasicAddon implementation for Addon. +func (a Addon) AsIoTAddon() (*IoTAddon, bool) { + return nil, false +} + +// AsAddon is the BasicAddon implementation for Addon. +func (a Addon) AsAddon() (*Addon, bool) { + return &a, true +} + +// AsBasicAddon is the BasicAddon implementation for Addon. +func (a Addon) AsBasicAddon() (BasicAddon, bool) { + return &a, true +} + +// AddonList collection of all the Role addon on the Azure Stack Edge device. +type AddonList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The Value. + Value *[]BasicAddon `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AddonList struct. +func (al *AddonList) 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 "value": + if v != nil { + value, err := unmarshalBasicAddonArray(*v) + if err != nil { + return err + } + al.Value = &value + } + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + al.NextLink = &nextLink + } + } + } + + return nil +} + +// AddonListIterator provides access to a complete listing of Addon values. +type AddonListIterator struct { + i int + page AddonListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AddonListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AddonListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AddonListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AddonListIterator) Response() AddonList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AddonListIterator) Value() BasicAddon { + if !iter.page.NotDone() { + return Addon{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AddonListIterator type. +func NewAddonListIterator(page AddonListPage) AddonListIterator { + return AddonListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (al AddonList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (al AddonList) hasNextLink() bool { + return al.NextLink != nil && len(*al.NextLink) != 0 +} + +// addonListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (al AddonList) addonListPreparer(ctx context.Context) (*http.Request, error) { + if !al.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(al.NextLink))) +} + +// AddonListPage contains a page of BasicAddon values. +type AddonListPage struct { + fn func(context.Context, AddonList) (AddonList, error) + al AddonList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AddonListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AddonListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.al) + if err != nil { + return err + } + page.al = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AddonListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AddonListPage) NotDone() bool { + return !page.al.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AddonListPage) Response() AddonList { + return page.al +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AddonListPage) Values() []BasicAddon { + if page.al.IsEmpty() { + return nil + } + return *page.al.Value +} + +// Creates a new instance of the AddonListPage type. +func NewAddonListPage(cur AddonList, getNextPage func(context.Context, AddonList) (AddonList, error)) AddonListPage { + return AddonListPage{ + fn: getNextPage, + al: cur, + } +} + +// AddonModel ... +type AddonModel struct { + autorest.Response `json:"-"` + Value BasicAddon `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for AddonModel struct. +func (am *AddonModel) UnmarshalJSON(body []byte) error { + a, err := unmarshalBasicAddon(body) + if err != nil { + return err + } + am.Value = a + + return nil +} + +// AddonsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type AddonsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AddonsClient) (AddonModel, error) +} + +// AddonsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type AddonsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(AddonsClient) (autorest.Response, error) +} + +// Address the shipping address of the customer. +type Address struct { + // AddressLine1 - The address line1. + AddressLine1 *string `json:"addressLine1,omitempty"` + // AddressLine2 - The address line2. + AddressLine2 *string `json:"addressLine2,omitempty"` + // AddressLine3 - The address line3. + AddressLine3 *string `json:"addressLine3,omitempty"` + // PostalCode - The postal code. + PostalCode *string `json:"postalCode,omitempty"` + // City - The city name. + City *string `json:"city,omitempty"` + // State - The state name. + State *string `json:"state,omitempty"` + // Country - The country name. + Country *string `json:"country,omitempty"` +} + +// Alert alert on the data box edge/gateway device. +type Alert struct { + autorest.Response `json:"-"` + // SystemData - Alert generated in the resource + SystemData *SystemData `json:"systemData,omitempty"` + // AlertProperties - READ-ONLY; Properties of alert. + *AlertProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Alert. +func (a Alert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.SystemData != nil { + objectMap["systemData"] = a.SystemData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Alert struct. +func (a *Alert) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + a.SystemData = &systemData + } + case "properties": + if v != nil { + var alertProperties AlertProperties + err = json.Unmarshal(*v, &alertProperties) + if err != nil { + return err + } + a.AlertProperties = &alertProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + } + } + + return nil +} + +// AlertErrorDetails error details for the alert. +type AlertErrorDetails struct { + // ErrorCode - READ-ONLY; Error code. + ErrorCode *string `json:"errorCode,omitempty"` + // ErrorMessage - READ-ONLY; Error Message. + ErrorMessage *string `json:"errorMessage,omitempty"` + // Occurrences - READ-ONLY; Number of occurrences. + Occurrences *int32 `json:"occurrences,omitempty"` +} + +// AlertList collection of alerts. +type AlertList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The value. + Value *[]Alert `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AlertListIterator provides access to a complete listing of Alert values. +type AlertListIterator struct { + i int + page AlertListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *AlertListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *AlertListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter AlertListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter AlertListIterator) Response() AlertList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter AlertListIterator) Value() Alert { + if !iter.page.NotDone() { + return Alert{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the AlertListIterator type. +func NewAlertListIterator(page AlertListPage) AlertListIterator { + return AlertListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (al AlertList) IsEmpty() bool { + return al.Value == nil || len(*al.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (al AlertList) hasNextLink() bool { + return al.NextLink != nil && len(*al.NextLink) != 0 +} + +// alertListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (al AlertList) alertListPreparer(ctx context.Context) (*http.Request, error) { + if !al.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(al.NextLink))) +} + +// AlertListPage contains a page of Alert values. +type AlertListPage struct { + fn func(context.Context, AlertList) (AlertList, error) + al AlertList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *AlertListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AlertListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.al) + if err != nil { + return err + } + page.al = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *AlertListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page AlertListPage) NotDone() bool { + return !page.al.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page AlertListPage) Response() AlertList { + return page.al +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page AlertListPage) Values() []Alert { + if page.al.IsEmpty() { + return nil + } + return *page.al.Value +} + +// Creates a new instance of the AlertListPage type. +func NewAlertListPage(cur AlertList, getNextPage func(context.Context, AlertList) (AlertList, error)) AlertListPage { + return AlertListPage{ + fn: getNextPage, + al: cur, + } +} + +// AlertProperties properties of alert. +type AlertProperties struct { + // Title - READ-ONLY; Alert title. + Title *string `json:"title,omitempty"` + // AlertType - READ-ONLY; Alert type. + AlertType *string `json:"alertType,omitempty"` + // AppearedAtDateTime - READ-ONLY; UTC time when the alert appeared. + AppearedAtDateTime *date.Time `json:"appearedAtDateTime,omitempty"` + // Recommendation - READ-ONLY; Alert recommendation. + Recommendation *string `json:"recommendation,omitempty"` + // Severity - READ-ONLY; Severity of the alert. Possible values include: 'Informational', 'Warning', 'Critical' + Severity AlertSeverity `json:"severity,omitempty"` + // ErrorDetails - READ-ONLY; Error details of the alert. + ErrorDetails *AlertErrorDetails `json:"errorDetails,omitempty"` + // DetailedInformation - READ-ONLY; Alert details. + DetailedInformation map[string]*string `json:"detailedInformation"` +} + +// MarshalJSON is the custom marshaler for AlertProperties. +func (ap AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// ArcAddon arc Addon. +type ArcAddon struct { + // ArcAddonProperties - Properties specific to Arc addon. + *ArcAddonProperties `json:"properties,omitempty"` + // SystemData - Addon type + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindAddon', 'KindArcForKubernetes', 'KindIotEdge' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArcAddon. +func (aa ArcAddon) MarshalJSON() ([]byte, error) { + aa.Kind = KindArcForKubernetes + objectMap := make(map[string]interface{}) + if aa.ArcAddonProperties != nil { + objectMap["properties"] = aa.ArcAddonProperties + } + if aa.SystemData != nil { + objectMap["systemData"] = aa.SystemData + } + if aa.Kind != "" { + objectMap["kind"] = aa.Kind + } + return json.Marshal(objectMap) +} + +// AsArcAddon is the BasicAddon implementation for ArcAddon. +func (aa ArcAddon) AsArcAddon() (*ArcAddon, bool) { + return &aa, true +} + +// AsIoTAddon is the BasicAddon implementation for ArcAddon. +func (aa ArcAddon) AsIoTAddon() (*IoTAddon, bool) { + return nil, false +} + +// AsAddon is the BasicAddon implementation for ArcAddon. +func (aa ArcAddon) AsAddon() (*Addon, bool) { + return nil, false +} + +// AsBasicAddon is the BasicAddon implementation for ArcAddon. +func (aa ArcAddon) AsBasicAddon() (BasicAddon, bool) { + return &aa, true +} + +// UnmarshalJSON is the custom unmarshaler for ArcAddon struct. +func (aa *ArcAddon) 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 "properties": + if v != nil { + var arcAddonProperties ArcAddonProperties + err = json.Unmarshal(*v, &arcAddonProperties) + if err != nil { + return err + } + aa.ArcAddonProperties = &arcAddonProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + aa.SystemData = &systemData + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + aa.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + aa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + aa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + aa.Type = &typeVar + } + } + } + + return nil +} + +// ArcAddonProperties arc addon properties. +type ArcAddonProperties struct { + // SubscriptionID - Arc resource subscription Id + SubscriptionID *string `json:"subscriptionId,omitempty"` + // ResourceGroupName - Arc resource group name + ResourceGroupName *string `json:"resourceGroupName,omitempty"` + // ResourceName - Arc resource Name + ResourceName *string `json:"resourceName,omitempty"` + // ResourceLocation - Arc resource location + ResourceLocation *string `json:"resourceLocation,omitempty"` + // Version - READ-ONLY; Arc resource version + Version *string `json:"version,omitempty"` + // HostPlatform - READ-ONLY; Host OS supported by the Arc addon. Possible values include: 'Windows', 'Linux' + HostPlatform PlatformType `json:"hostPlatform,omitempty"` + // HostPlatformType - READ-ONLY; Platform where the runtime is hosted. Possible values include: 'KubernetesCluster', 'LinuxVM' + HostPlatformType HostPlatformType `json:"hostPlatformType,omitempty"` + // ProvisioningState - READ-ONLY; Addon Provisioning State. Possible values include: 'Invalid', 'Creating', 'Created', 'Updating', 'Reconfiguring', 'Failed', 'Deleting' + ProvisioningState AddonState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for ArcAddonProperties. +func (aap ArcAddonProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if aap.SubscriptionID != nil { + objectMap["subscriptionId"] = aap.SubscriptionID + } + if aap.ResourceGroupName != nil { + objectMap["resourceGroupName"] = aap.ResourceGroupName + } + if aap.ResourceName != nil { + objectMap["resourceName"] = aap.ResourceName + } + if aap.ResourceLocation != nil { + objectMap["resourceLocation"] = aap.ResourceLocation + } + return json.Marshal(objectMap) +} + +// ARMBaseModel represents the base class for all object models. +type ARMBaseModel struct { + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// AsymmetricEncryptedSecret represent the secrets intended for encryption with asymmetric key pair. +type AsymmetricEncryptedSecret struct { + // Value - The value of the secret. + Value *string `json:"value,omitempty"` + // EncryptionCertThumbprint - Thumbprint certificate used to encrypt \"Value\". If the value is unencrypted, it will be null. + EncryptionCertThumbprint *string `json:"encryptionCertThumbprint,omitempty"` + // EncryptionAlgorithm - The algorithm used to encrypt "Value". Possible values include: 'None', 'AES256', 'RSAESPKCS1V15' + EncryptionAlgorithm EncryptionAlgorithm `json:"encryptionAlgorithm,omitempty"` +} + +// Authentication authentication mechanism for IoT devices. +type Authentication struct { + // SymmetricKey - Symmetric key for authentication. + SymmetricKey *SymmetricKey `json:"symmetricKey,omitempty"` +} + +// AzureContainerInfo azure container mapping of the endpoint. +type AzureContainerInfo struct { + // StorageAccountCredentialID - ID of the storage account credential used to access storage. + StorageAccountCredentialID *string `json:"storageAccountCredentialId,omitempty"` + // ContainerName - Container name (Based on the data format specified, this represents the name of Azure Files/Page blob/Block blob). + ContainerName *string `json:"containerName,omitempty"` + // DataFormat - Storage format used for the file represented by the share. Possible values include: 'BlockBlob', 'PageBlob', 'AzureFile' + DataFormat AzureContainerDataFormat `json:"dataFormat,omitempty"` +} + +// BandwidthSchedule the bandwidth schedule details. +type BandwidthSchedule struct { + autorest.Response `json:"-"` + // SystemData - Bandwidth object related to ASE resource + SystemData *SystemData `json:"systemData,omitempty"` + // BandwidthScheduleProperties - The properties of the bandwidth schedule. + *BandwidthScheduleProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for BandwidthSchedule. +func (bs BandwidthSchedule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if bs.SystemData != nil { + objectMap["systemData"] = bs.SystemData + } + if bs.BandwidthScheduleProperties != nil { + objectMap["properties"] = bs.BandwidthScheduleProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for BandwidthSchedule struct. +func (bs *BandwidthSchedule) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + bs.SystemData = &systemData + } + case "properties": + if v != nil { + var bandwidthScheduleProperties BandwidthScheduleProperties + err = json.Unmarshal(*v, &bandwidthScheduleProperties) + if err != nil { + return err + } + bs.BandwidthScheduleProperties = &bandwidthScheduleProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + bs.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + bs.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + bs.Type = &typeVar + } + } + } + + return nil +} + +// BandwidthScheduleProperties the properties of the bandwidth schedule. +type BandwidthScheduleProperties struct { + // Start - The start time of the schedule in UTC. + Start *string `json:"start,omitempty"` + // Stop - The stop time of the schedule in UTC. + Stop *string `json:"stop,omitempty"` + // RateInMbps - The bandwidth rate in Mbps. + RateInMbps *int32 `json:"rateInMbps,omitempty"` + // Days - The days of the week when this schedule is applicable. + Days *[]DayOfWeek `json:"days,omitempty"` +} + +// BandwidthSchedulesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BandwidthSchedulesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BandwidthSchedulesClient) (BandwidthSchedule, error) +} + +// BandwidthSchedulesDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type BandwidthSchedulesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(BandwidthSchedulesClient) (autorest.Response, error) +} + +// BandwidthSchedulesList the collection of bandwidth schedules. +type BandwidthSchedulesList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of bandwidth schedules. + Value *[]BandwidthSchedule `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// BandwidthSchedulesListIterator provides access to a complete listing of BandwidthSchedule values. +type BandwidthSchedulesListIterator struct { + i int + page BandwidthSchedulesListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *BandwidthSchedulesListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *BandwidthSchedulesListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter BandwidthSchedulesListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter BandwidthSchedulesListIterator) Response() BandwidthSchedulesList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter BandwidthSchedulesListIterator) Value() BandwidthSchedule { + if !iter.page.NotDone() { + return BandwidthSchedule{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the BandwidthSchedulesListIterator type. +func NewBandwidthSchedulesListIterator(page BandwidthSchedulesListPage) BandwidthSchedulesListIterator { + return BandwidthSchedulesListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (bsl BandwidthSchedulesList) IsEmpty() bool { + return bsl.Value == nil || len(*bsl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (bsl BandwidthSchedulesList) hasNextLink() bool { + return bsl.NextLink != nil && len(*bsl.NextLink) != 0 +} + +// bandwidthSchedulesListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (bsl BandwidthSchedulesList) bandwidthSchedulesListPreparer(ctx context.Context) (*http.Request, error) { + if !bsl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(bsl.NextLink))) +} + +// BandwidthSchedulesListPage contains a page of BandwidthSchedule values. +type BandwidthSchedulesListPage struct { + fn func(context.Context, BandwidthSchedulesList) (BandwidthSchedulesList, error) + bsl BandwidthSchedulesList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *BandwidthSchedulesListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/BandwidthSchedulesListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.bsl) + if err != nil { + return err + } + page.bsl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *BandwidthSchedulesListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page BandwidthSchedulesListPage) NotDone() bool { + return !page.bsl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page BandwidthSchedulesListPage) Response() BandwidthSchedulesList { + return page.bsl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page BandwidthSchedulesListPage) Values() []BandwidthSchedule { + if page.bsl.IsEmpty() { + return nil + } + return *page.bsl.Value +} + +// Creates a new instance of the BandwidthSchedulesListPage type. +func NewBandwidthSchedulesListPage(cur BandwidthSchedulesList, getNextPage func(context.Context, BandwidthSchedulesList) (BandwidthSchedulesList, error)) BandwidthSchedulesListPage { + return BandwidthSchedulesListPage{ + fn: getNextPage, + bsl: cur, + } +} + +// ClientAccessRight the mapping between a particular client IP and the type of access client has on the +// NFS share. +type ClientAccessRight struct { + // Client - IP of the client. + Client *string `json:"client,omitempty"` + // AccessPermission - Type of access to be allowed for the client. Possible values include: 'NoAccess', 'ReadOnly', 'ReadWrite' + AccessPermission ClientPermissionType `json:"accessPermission,omitempty"` +} + +// CloudEdgeManagementRole cloudEdgeManagementRole role. +type CloudEdgeManagementRole struct { + // CloudEdgeManagementRoleProperties - Properties specific to CloudEdgeManagementRole role. + *CloudEdgeManagementRoleProperties `json:"properties,omitempty"` + // SystemData - Role configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` + // Kind - Possible values include: 'KindRole', 'KindCloudEdgeManagement', 'KindIOT', 'KindKubernetes', 'KindMEC' + Kind KindBasicRole `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) MarshalJSON() ([]byte, error) { + cemr.Kind = KindCloudEdgeManagement + objectMap := make(map[string]interface{}) + if cemr.CloudEdgeManagementRoleProperties != nil { + objectMap["properties"] = cemr.CloudEdgeManagementRoleProperties + } + if cemr.SystemData != nil { + objectMap["systemData"] = cemr.SystemData + } + if cemr.Kind != "" { + objectMap["kind"] = cemr.Kind + } + return json.Marshal(objectMap) +} + +// AsCloudEdgeManagementRole is the BasicRole implementation for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) AsCloudEdgeManagementRole() (*CloudEdgeManagementRole, bool) { + return &cemr, true +} + +// AsIoTRole is the BasicRole implementation for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) AsIoTRole() (*IoTRole, bool) { + return nil, false +} + +// AsKubernetesRole is the BasicRole implementation for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) AsKubernetesRole() (*KubernetesRole, bool) { + return nil, false +} + +// AsMECRole is the BasicRole implementation for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) AsMECRole() (*MECRole, bool) { + return nil, false +} + +// AsRole is the BasicRole implementation for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) AsRole() (*Role, bool) { + return nil, false +} + +// AsBasicRole is the BasicRole implementation for CloudEdgeManagementRole. +func (cemr CloudEdgeManagementRole) AsBasicRole() (BasicRole, bool) { + return &cemr, true +} + +// UnmarshalJSON is the custom unmarshaler for CloudEdgeManagementRole struct. +func (cemr *CloudEdgeManagementRole) 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 "properties": + if v != nil { + var cloudEdgeManagementRoleProperties CloudEdgeManagementRoleProperties + err = json.Unmarshal(*v, &cloudEdgeManagementRoleProperties) + if err != nil { + return err + } + cemr.CloudEdgeManagementRoleProperties = &cloudEdgeManagementRoleProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + cemr.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicRole + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + cemr.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + cemr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + cemr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + cemr.Type = &typeVar + } + } + } + + return nil +} + +// CloudEdgeManagementRoleProperties cloudEdgeManagement Role properties. +type CloudEdgeManagementRoleProperties struct { + // LocalManagementStatus - READ-ONLY; Local Edge Management Status. Possible values include: 'RoleStatusEnabled', 'RoleStatusDisabled' + LocalManagementStatus RoleStatus `json:"localManagementStatus,omitempty"` + // EdgeProfile - READ-ONLY; Edge Profile of the resource + EdgeProfile *EdgeProfile `json:"edgeProfile,omitempty"` + // RoleStatus - Role status. Possible values include: 'RoleStatusEnabled', 'RoleStatusDisabled' + RoleStatus RoleStatus `json:"roleStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for CloudEdgeManagementRoleProperties. +func (cemrp CloudEdgeManagementRoleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cemrp.RoleStatus != "" { + objectMap["roleStatus"] = cemrp.RoleStatus + } + return json.Marshal(objectMap) +} + +// CloudError an error response from the service. +type CloudError struct { + // Error - The error details. + Error *CloudErrorBody `json:"error,omitempty"` +} + +// CloudErrorBody an error response from the service. +type CloudErrorBody struct { + // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. + Code *string `json:"code,omitempty"` + // Message - A message describing the error, intended to be suitable for display in a user interface. + Message *string `json:"message,omitempty"` + // Details - A list of additional details about the error. + Details *[]CloudErrorBody `json:"details,omitempty"` +} + +// CniConfig cni configuration +type CniConfig struct { + // Type - READ-ONLY; Cni type + Type *string `json:"type,omitempty"` + // Version - READ-ONLY; Cni version + Version *string `json:"version,omitempty"` + // PodSubnet - READ-ONLY; Pod Subnet + PodSubnet *string `json:"podSubnet,omitempty"` + // ServiceSubnet - READ-ONLY; Service subnet + ServiceSubnet *string `json:"serviceSubnet,omitempty"` +} + +// ComputeResource compute infrastructure Resource +type ComputeResource struct { + // ProcessorCount - Processor count + ProcessorCount *int32 `json:"processorCount,omitempty"` + // MemoryInGB - Memory in GB + MemoryInGB *int64 `json:"memoryInGB,omitempty"` +} + +// ContactDetails contains all the contact details of the customer. +type ContactDetails struct { + // ContactPerson - The contact person name. + ContactPerson *string `json:"contactPerson,omitempty"` + // CompanyName - The name of the company. + CompanyName *string `json:"companyName,omitempty"` + // Phone - The phone number. + Phone *string `json:"phone,omitempty"` + // EmailList - The email list. + EmailList *[]string `json:"emailList,omitempty"` +} + +// Container represents a container on the Data Box Edge/Gateway device. +type Container struct { + autorest.Response `json:"-"` + // SystemData - Container in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty"` + // ContainerProperties - The container properties. + *ContainerProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Container. +func (c Container) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if c.SystemData != nil { + objectMap["systemData"] = c.SystemData + } + if c.ContainerProperties != nil { + objectMap["properties"] = c.ContainerProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Container struct. +func (c *Container) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + c.SystemData = &systemData + } + case "properties": + if v != nil { + var containerProperties ContainerProperties + err = json.Unmarshal(*v, &containerProperties) + if err != nil { + return err + } + c.ContainerProperties = &containerProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + c.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + c.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + c.Type = &typeVar + } + } + } + + return nil +} + +// ContainerList collection of all the containers on the Data Box Edge/Gateway device. +type ContainerList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of containers. + Value *[]Container `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ContainerListIterator provides access to a complete listing of Container values. +type ContainerListIterator struct { + i int + page ContainerListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ContainerListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ContainerListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ContainerListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ContainerListIterator) Response() ContainerList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ContainerListIterator) Value() Container { + if !iter.page.NotDone() { + return Container{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ContainerListIterator type. +func NewContainerListIterator(page ContainerListPage) ContainerListIterator { + return ContainerListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (cl ContainerList) IsEmpty() bool { + return cl.Value == nil || len(*cl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (cl ContainerList) hasNextLink() bool { + return cl.NextLink != nil && len(*cl.NextLink) != 0 +} + +// containerListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (cl ContainerList) containerListPreparer(ctx context.Context) (*http.Request, error) { + if !cl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(cl.NextLink))) +} + +// ContainerListPage contains a page of Container values. +type ContainerListPage struct { + fn func(context.Context, ContainerList) (ContainerList, error) + cl ContainerList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ContainerListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ContainerListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.cl) + if err != nil { + return err + } + page.cl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ContainerListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ContainerListPage) NotDone() bool { + return !page.cl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ContainerListPage) Response() ContainerList { + return page.cl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ContainerListPage) Values() []Container { + if page.cl.IsEmpty() { + return nil + } + return *page.cl.Value +} + +// Creates a new instance of the ContainerListPage type. +func NewContainerListPage(cur ContainerList, getNextPage func(context.Context, ContainerList) (ContainerList, error)) ContainerListPage { + return ContainerListPage{ + fn: getNextPage, + cl: cur, + } +} + +// ContainerProperties the container properties. +type ContainerProperties struct { + // ContainerStatus - READ-ONLY; Current status of the container. Possible values include: 'ContainerStatusOK', 'ContainerStatusOffline', 'ContainerStatusUnknown', 'ContainerStatusUpdating', 'ContainerStatusNeedsAttention' + ContainerStatus ContainerStatus `json:"containerStatus,omitempty"` + // DataFormat - DataFormat for Container. Possible values include: 'BlockBlob', 'PageBlob', 'AzureFile' + DataFormat AzureContainerDataFormat `json:"dataFormat,omitempty"` + // RefreshDetails - READ-ONLY; Details of the refresh job on this container. + RefreshDetails *RefreshDetails `json:"refreshDetails,omitempty"` + // CreatedDateTime - READ-ONLY; The UTC time when container got created. + CreatedDateTime *date.Time `json:"createdDateTime,omitempty"` +} + +// MarshalJSON is the custom marshaler for ContainerProperties. +func (cp ContainerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if cp.DataFormat != "" { + objectMap["dataFormat"] = cp.DataFormat + } + return json.Marshal(objectMap) +} + +// ContainersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type ContainersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainersClient) (Container, error) +} + +// ContainersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainersClient) (autorest.Response, error) +} + +// ContainersRefreshFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type ContainersRefreshFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(ContainersClient) (autorest.Response, error) +} + +// DCAccessCode DC Access code in the case of Self Managed Shipping. +type DCAccessCode struct { + autorest.Response `json:"-"` + // DCAccessCodeProperties - DCAccessCode properties. + *DCAccessCodeProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DCAccessCode. +func (dac DCAccessCode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dac.DCAccessCodeProperties != nil { + objectMap["properties"] = dac.DCAccessCodeProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DCAccessCode struct. +func (dac *DCAccessCode) 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 "properties": + if v != nil { + var dCAccessCodeProperties DCAccessCodeProperties + err = json.Unmarshal(*v, &dCAccessCodeProperties) + if err != nil { + return err + } + dac.DCAccessCodeProperties = &dCAccessCodeProperties + } + } + } + + return nil +} + +// DCAccessCodeProperties dCAccessCode Properties. +type DCAccessCodeProperties struct { + // AuthCode - DCAccess Code for the Self Managed shipment. + AuthCode *string `json:"authCode,omitempty"` +} + +// Device the Data Box Edge/Gateway device. +type Device struct { + autorest.Response `json:"-"` + // Location - The location of the device. This is a supported and registered Azure geographical region (for example, West US, East US, or Southeast Asia). The geographical region of a device cannot be changed once it is created, but if an identical geographical region is specified on update, the request will succeed. + Location *string `json:"location,omitempty"` + // Tags - The list of tags that describe the device. These tags can be used to view and group this device (across resource groups). + Tags map[string]*string `json:"tags"` + // Sku - The SKU type. + Sku *Sku `json:"sku,omitempty"` + // Etag - The etag for the devices. + Etag *string `json:"etag,omitempty"` + // Identity - Msi identity of the resource + Identity *ResourceIdentity `json:"identity,omitempty"` + // Kind - The etag for the devices. Possible values include: 'AzureDataBoxGateway', 'AzureStackEdge', 'AzureStackHub', 'AzureModularDataCentre' + Kind DeviceKind `json:"kind,omitempty"` + // SystemData - DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty"` + // DeviceProperties - The properties of the Data Box Edge/Gateway device. + *DeviceProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Device. +func (d Device) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if d.Location != nil { + objectMap["location"] = d.Location + } + if d.Tags != nil { + objectMap["tags"] = d.Tags + } + if d.Sku != nil { + objectMap["sku"] = d.Sku + } + if d.Etag != nil { + objectMap["etag"] = d.Etag + } + if d.Identity != nil { + objectMap["identity"] = d.Identity + } + if d.Kind != "" { + objectMap["kind"] = d.Kind + } + if d.SystemData != nil { + objectMap["systemData"] = d.SystemData + } + if d.DeviceProperties != nil { + objectMap["properties"] = d.DeviceProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Device struct. +func (d *Device) 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 "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + d.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + d.Tags = tags + } + case "sku": + if v != nil { + var sku Sku + err = json.Unmarshal(*v, &sku) + if err != nil { + return err + } + d.Sku = &sku + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + d.Etag = &etag + } + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + d.Identity = &identity + } + case "kind": + if v != nil { + var kind DeviceKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + d.Kind = kind + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + d.SystemData = &systemData + } + case "properties": + if v != nil { + var deviceProperties DeviceProperties + err = json.Unmarshal(*v, &deviceProperties) + if err != nil { + return err + } + d.DeviceProperties = &deviceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + d.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + d.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + d.Type = &typeVar + } + } + } + + return nil +} + +// DeviceExtendedInfo the extended Info of the Data Box Edge/Gateway device. +type DeviceExtendedInfo struct { + autorest.Response `json:"-"` + // DeviceExtendedInfoProperties - The extended info properties. + *DeviceExtendedInfoProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeviceExtendedInfo. +func (dei DeviceExtendedInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dei.DeviceExtendedInfoProperties != nil { + objectMap["properties"] = dei.DeviceExtendedInfoProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DeviceExtendedInfo struct. +func (dei *DeviceExtendedInfo) 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 "properties": + if v != nil { + var deviceExtendedInfoProperties DeviceExtendedInfoProperties + err = json.Unmarshal(*v, &deviceExtendedInfoProperties) + if err != nil { + return err + } + dei.DeviceExtendedInfoProperties = &deviceExtendedInfoProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + dei.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + dei.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + dei.Type = &typeVar + } + } + } + + return nil +} + +// DeviceExtendedInfoPatch the Data Box Edge/Gateway device extended info patch. +type DeviceExtendedInfoPatch struct { + // ClientSecretStoreID - The Key Vault ARM Id for client secrets + ClientSecretStoreID *string `json:"clientSecretStoreId,omitempty"` + // ClientSecretStoreURL - The url to access the Client Key Vault + ClientSecretStoreURL *string `json:"clientSecretStoreUrl,omitempty"` + // ChannelIntegrityKeyName - The name for Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyName *string `json:"channelIntegrityKeyName,omitempty"` + // ChannelIntegrityKeyVersion - The version of Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyVersion *string `json:"channelIntegrityKeyVersion,omitempty"` +} + +// DeviceExtendedInfoProperties the properties of the Data Box Edge/Gateway device extended info. +type DeviceExtendedInfoProperties struct { + // EncryptionKeyThumbprint - The digital signature of encrypted certificate. + EncryptionKeyThumbprint *string `json:"encryptionKeyThumbprint,omitempty"` + // EncryptionKey - The public part of the encryption certificate. Client uses this to encrypt any secret. + EncryptionKey *string `json:"encryptionKey,omitempty"` + // ResourceKey - READ-ONLY; The Resource ID of the Resource. + ResourceKey *string `json:"resourceKey,omitempty"` + // ClientSecretStoreID - The Key Vault ARM Id for client secrets + ClientSecretStoreID *string `json:"clientSecretStoreId,omitempty"` + // ClientSecretStoreURL - The url to access the Client Key Vault + ClientSecretStoreURL *string `json:"clientSecretStoreUrl,omitempty"` + // ChannelIntegrityKeyName - The name of Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyName *string `json:"channelIntegrityKeyName,omitempty"` + // ChannelIntegrityKeyVersion - The version of Channel Integrity Key stored in the Client Key Vault + ChannelIntegrityKeyVersion *string `json:"channelIntegrityKeyVersion,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeviceExtendedInfoProperties. +func (deip DeviceExtendedInfoProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if deip.EncryptionKeyThumbprint != nil { + objectMap["encryptionKeyThumbprint"] = deip.EncryptionKeyThumbprint + } + if deip.EncryptionKey != nil { + objectMap["encryptionKey"] = deip.EncryptionKey + } + if deip.ClientSecretStoreID != nil { + objectMap["clientSecretStoreId"] = deip.ClientSecretStoreID + } + if deip.ClientSecretStoreURL != nil { + objectMap["clientSecretStoreUrl"] = deip.ClientSecretStoreURL + } + if deip.ChannelIntegrityKeyName != nil { + objectMap["channelIntegrityKeyName"] = deip.ChannelIntegrityKeyName + } + if deip.ChannelIntegrityKeyVersion != nil { + objectMap["channelIntegrityKeyVersion"] = deip.ChannelIntegrityKeyVersion + } + return json.Marshal(objectMap) +} + +// DeviceList the collection of Data Box Edge/Gateway devices. +type DeviceList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of Data Box Edge/Gateway devices. + Value *[]Device `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DeviceListIterator provides access to a complete listing of Device values. +type DeviceListIterator struct { + i int + page DeviceListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *DeviceListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DeviceListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DeviceListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter DeviceListIterator) Response() DeviceList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter DeviceListIterator) Value() Device { + if !iter.page.NotDone() { + return Device{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DeviceListIterator type. +func NewDeviceListIterator(page DeviceListPage) DeviceListIterator { + return DeviceListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dl DeviceList) IsEmpty() bool { + return dl.Value == nil || len(*dl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (dl DeviceList) hasNextLink() bool { + return dl.NextLink != nil && len(*dl.NextLink) != 0 +} + +// deviceListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dl DeviceList) deviceListPreparer(ctx context.Context) (*http.Request, error) { + if !dl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dl.NextLink))) +} + +// DeviceListPage contains a page of Device values. +type DeviceListPage struct { + fn func(context.Context, DeviceList) (DeviceList, error) + dl DeviceList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *DeviceListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DeviceListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.dl) + if err != nil { + return err + } + page.dl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *DeviceListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DeviceListPage) NotDone() bool { + return !page.dl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DeviceListPage) Response() DeviceList { + return page.dl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DeviceListPage) Values() []Device { + if page.dl.IsEmpty() { + return nil + } + return *page.dl.Value +} + +// Creates a new instance of the DeviceListPage type. +func NewDeviceListPage(cur DeviceList, getNextPage func(context.Context, DeviceList) (DeviceList, error)) DeviceListPage { + return DeviceListPage{ + fn: getNextPage, + dl: cur, + } +} + +// DevicePatch the Data Box Edge/Gateway device patch. +type DevicePatch struct { + // Tags - The tags attached to the Data Box Edge/Gateway resource. + Tags map[string]*string `json:"tags"` + // Identity - Msi identity of the resource + Identity *ResourceIdentity `json:"identity,omitempty"` + // DevicePropertiesPatch - The properties associated with the Data Box Edge/Gateway resource + *DevicePropertiesPatch `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for DevicePatch. +func (dp DevicePatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dp.Tags != nil { + objectMap["tags"] = dp.Tags + } + if dp.Identity != nil { + objectMap["identity"] = dp.Identity + } + if dp.DevicePropertiesPatch != nil { + objectMap["properties"] = dp.DevicePropertiesPatch + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DevicePatch struct. +func (dp *DevicePatch) 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 "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + dp.Tags = tags + } + case "identity": + if v != nil { + var identity ResourceIdentity + err = json.Unmarshal(*v, &identity) + if err != nil { + return err + } + dp.Identity = &identity + } + case "properties": + if v != nil { + var devicePropertiesPatch DevicePropertiesPatch + err = json.Unmarshal(*v, &devicePropertiesPatch) + if err != nil { + return err + } + dp.DevicePropertiesPatch = &devicePropertiesPatch + } + } + } + + return nil +} + +// DeviceProperties the properties of the Data Box Edge/Gateway device. +type DeviceProperties struct { + // DataBoxEdgeDeviceStatus - The status of the Data Box Edge/Gateway device. Possible values include: 'ReadyToSetup', 'Online', 'Offline', 'NeedsAttention', 'Disconnected', 'PartiallyDisconnected', 'Maintenance' + DataBoxEdgeDeviceStatus DeviceStatus `json:"dataBoxEdgeDeviceStatus,omitempty"` + // SerialNumber - READ-ONLY; The Serial Number of Data Box Edge/Gateway device. + SerialNumber *string `json:"serialNumber,omitempty"` + // Description - The Description of the Data Box Edge/Gateway device. + Description *string `json:"description,omitempty"` + // ModelDescription - The description of the Data Box Edge/Gateway device model. + ModelDescription *string `json:"modelDescription,omitempty"` + // DeviceType - READ-ONLY; The type of the Data Box Edge/Gateway device. Possible values include: 'DataBoxEdgeDevice' + DeviceType DeviceType `json:"deviceType,omitempty"` + // FriendlyName - The Data Box Edge/Gateway device name. + FriendlyName *string `json:"friendlyName,omitempty"` + // Culture - READ-ONLY; The Data Box Edge/Gateway device culture. + Culture *string `json:"culture,omitempty"` + // DeviceModel - READ-ONLY; The Data Box Edge/Gateway device model. + DeviceModel *string `json:"deviceModel,omitempty"` + // DeviceSoftwareVersion - READ-ONLY; The Data Box Edge/Gateway device software version. + DeviceSoftwareVersion *string `json:"deviceSoftwareVersion,omitempty"` + // DeviceLocalCapacity - READ-ONLY; The Data Box Edge/Gateway device local capacity in MB. + DeviceLocalCapacity *int64 `json:"deviceLocalCapacity,omitempty"` + // TimeZone - READ-ONLY; The Data Box Edge/Gateway device timezone. + TimeZone *string `json:"timeZone,omitempty"` + // DeviceHcsVersion - READ-ONLY; The device software version number of the device (eg: 1.2.18105.6). + DeviceHcsVersion *string `json:"deviceHcsVersion,omitempty"` + // ConfiguredRoleTypes - READ-ONLY; Type of compute roles configured. + ConfiguredRoleTypes *[]RoleTypes `json:"configuredRoleTypes,omitempty"` + // NodeCount - READ-ONLY; The number of nodes in the cluster. + NodeCount *int32 `json:"nodeCount,omitempty"` + // ResourceMoveDetails - The details of the move operation on this resource. + ResourceMoveDetails *ResourceMoveDetails `json:"resourceMoveDetails,omitempty"` + // EdgeProfile - The details of Edge Profile for this resource + EdgeProfile *EdgeProfile `json:"edgeProfile,omitempty"` +} + +// MarshalJSON is the custom marshaler for DeviceProperties. +func (dp DeviceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if dp.DataBoxEdgeDeviceStatus != "" { + objectMap["dataBoxEdgeDeviceStatus"] = dp.DataBoxEdgeDeviceStatus + } + if dp.Description != nil { + objectMap["description"] = dp.Description + } + if dp.ModelDescription != nil { + objectMap["modelDescription"] = dp.ModelDescription + } + if dp.FriendlyName != nil { + objectMap["friendlyName"] = dp.FriendlyName + } + if dp.ResourceMoveDetails != nil { + objectMap["resourceMoveDetails"] = dp.ResourceMoveDetails + } + if dp.EdgeProfile != nil { + objectMap["edgeProfile"] = dp.EdgeProfile + } + return json.Marshal(objectMap) +} + +// DevicePropertiesPatch the Data Box Edge/Gateway device properties patch. +type DevicePropertiesPatch struct { + // EdgeProfile - Edge Profile property of the Data Box Edge/Gateway device + EdgeProfile *EdgeProfilePatch `json:"edgeProfile,omitempty"` +} + +// DevicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DevicesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DevicesClient) (Device, error) +} + +// DevicesCreateOrUpdateSecuritySettingsFuture an abstraction for monitoring and retrieving the results of +// a long-running operation. +type DevicesCreateOrUpdateSecuritySettingsFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DevicesClient) (autorest.Response, error) +} + +// DevicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DevicesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DevicesClient) (autorest.Response, error) +} + +// DevicesDownloadUpdatesFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DevicesDownloadUpdatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DevicesClient) (autorest.Response, error) +} + +// DevicesInstallUpdatesFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DevicesInstallUpdatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DevicesClient) (autorest.Response, error) +} + +// DevicesScanForUpdatesFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DevicesScanForUpdatesFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(DevicesClient) (autorest.Response, error) +} + +// EdgeProfile details about Edge Profile for the resource +type EdgeProfile struct { + // Subscription - Edge Profile Subscription + Subscription *EdgeProfileSubscription `json:"subscription,omitempty"` +} + +// EdgeProfilePatch the Data Box Edge/Gateway Edge Profile patch. +type EdgeProfilePatch struct { + // Subscription - The Data Box Edge/Gateway Edge Profile Subscription patch + Subscription *EdgeProfileSubscriptionPatch `json:"subscription,omitempty"` +} + +// EdgeProfileSubscription subscription details for the Edge Profile +type EdgeProfileSubscription struct { + // RegistrationID - Edge Subscription Registration ID + RegistrationID *string `json:"registrationId,omitempty"` + // ID - ARM ID of the subscription + ID *string `json:"id,omitempty"` + // State - Possible values include: 'Registered', 'Warned', 'Suspended', 'Deleted', 'Unregistered' + State SubscriptionState `json:"state,omitempty"` + RegistrationDate *string `json:"registrationDate,omitempty"` + SubscriptionID *string `json:"subscriptionId,omitempty"` + *SubscriptionProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for EdgeProfileSubscription. +func (eps EdgeProfileSubscription) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if eps.RegistrationID != nil { + objectMap["registrationId"] = eps.RegistrationID + } + if eps.ID != nil { + objectMap["id"] = eps.ID + } + if eps.State != "" { + objectMap["state"] = eps.State + } + if eps.RegistrationDate != nil { + objectMap["registrationDate"] = eps.RegistrationDate + } + if eps.SubscriptionID != nil { + objectMap["subscriptionId"] = eps.SubscriptionID + } + if eps.SubscriptionProperties != nil { + objectMap["properties"] = eps.SubscriptionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for EdgeProfileSubscription struct. +func (eps *EdgeProfileSubscription) 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 "registrationId": + if v != nil { + var registrationID string + err = json.Unmarshal(*v, ®istrationID) + if err != nil { + return err + } + eps.RegistrationID = ®istrationID + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + eps.ID = &ID + } + case "state": + if v != nil { + var state SubscriptionState + err = json.Unmarshal(*v, &state) + if err != nil { + return err + } + eps.State = state + } + case "registrationDate": + if v != nil { + var registrationDate string + err = json.Unmarshal(*v, ®istrationDate) + if err != nil { + return err + } + eps.RegistrationDate = ®istrationDate + } + case "subscriptionId": + if v != nil { + var subscriptionID string + err = json.Unmarshal(*v, &subscriptionID) + if err != nil { + return err + } + eps.SubscriptionID = &subscriptionID + } + case "properties": + if v != nil { + var subscriptionProperties SubscriptionProperties + err = json.Unmarshal(*v, &subscriptionProperties) + if err != nil { + return err + } + eps.SubscriptionProperties = &subscriptionProperties + } + } + } + + return nil +} + +// EdgeProfileSubscriptionPatch the Data Box Edge/Gateway Edge Profile Subscription patch. +type EdgeProfileSubscriptionPatch struct { + // ID - The path ID that uniquely identifies the subscription of the edge profile. + ID *string `json:"id,omitempty"` +} + +// EtcdInfo etcd configuration +type EtcdInfo struct { + // Type - READ-ONLY; Etcd type + Type *string `json:"type,omitempty"` + // Version - READ-ONLY; Etcd version + Version *string `json:"version,omitempty"` +} + +// FileEventTrigger trigger details. +type FileEventTrigger struct { + // FileTriggerProperties - File trigger properties. + *FileTriggerProperties `json:"properties,omitempty"` + // SystemData - Trigger in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` + // Kind - Possible values include: 'KindTrigger', 'KindFileEvent', 'KindPeriodicTimerEvent' + Kind KindBasicTrigger `json:"kind,omitempty"` +} + +// MarshalJSON is the custom marshaler for FileEventTrigger. +func (fet FileEventTrigger) MarshalJSON() ([]byte, error) { + fet.Kind = KindFileEvent + objectMap := make(map[string]interface{}) + if fet.FileTriggerProperties != nil { + objectMap["properties"] = fet.FileTriggerProperties + } + if fet.SystemData != nil { + objectMap["systemData"] = fet.SystemData + } + if fet.Kind != "" { + objectMap["kind"] = fet.Kind + } + return json.Marshal(objectMap) +} + +// AsFileEventTrigger is the BasicTrigger implementation for FileEventTrigger. +func (fet FileEventTrigger) AsFileEventTrigger() (*FileEventTrigger, bool) { + return &fet, true +} + +// AsPeriodicTimerEventTrigger is the BasicTrigger implementation for FileEventTrigger. +func (fet FileEventTrigger) AsPeriodicTimerEventTrigger() (*PeriodicTimerEventTrigger, bool) { + return nil, false +} + +// AsTrigger is the BasicTrigger implementation for FileEventTrigger. +func (fet FileEventTrigger) AsTrigger() (*Trigger, bool) { + return nil, false +} + +// AsBasicTrigger is the BasicTrigger implementation for FileEventTrigger. +func (fet FileEventTrigger) AsBasicTrigger() (BasicTrigger, bool) { + return &fet, true +} + +// UnmarshalJSON is the custom unmarshaler for FileEventTrigger struct. +func (fet *FileEventTrigger) 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 "properties": + if v != nil { + var fileTriggerProperties FileTriggerProperties + err = json.Unmarshal(*v, &fileTriggerProperties) + if err != nil { + return err + } + fet.FileTriggerProperties = &fileTriggerProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + fet.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicTrigger + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + fet.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + fet.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + fet.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + fet.Type = &typeVar + } + } + } + + return nil +} + +// FileSourceInfo file source details. +type FileSourceInfo struct { + // ShareID - File share ID. + ShareID *string `json:"shareId,omitempty"` +} + +// FileTriggerProperties file trigger properties. +type FileTriggerProperties struct { + // SourceInfo - File event source details. + SourceInfo *FileSourceInfo `json:"sourceInfo,omitempty"` + // SinkInfo - Role sink info. + SinkInfo *RoleSinkInfo `json:"sinkInfo,omitempty"` + // CustomContextTag - A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. + CustomContextTag *string `json:"customContextTag,omitempty"` +} + +// GenerateCertResponse used in activation key generation flow. +type GenerateCertResponse struct { + autorest.Response `json:"-"` + // PublicKey - Gets or sets base64 encoded certificate raw data, + // this is the public part needed to be uploaded to cert vault + PublicKey *string `json:"publicKey,omitempty"` + // PrivateKey - Gets or sets base64 encoded private part of the certificate, + // needed to form the activation key + PrivateKey *string `json:"privateKey,omitempty"` + // ExpiryTimeInUTC - Gets or sets expiry time in UTC + ExpiryTimeInUTC *string `json:"expiryTimeInUTC,omitempty"` +} + +// ImageRepositoryCredential image repository credential. +type ImageRepositoryCredential struct { + // ImageRepositoryURL - Image repository url (e.g.: mcr.microsoft.com). + ImageRepositoryURL *string `json:"imageRepositoryUrl,omitempty"` + // UserName - Repository user name. + UserName *string `json:"userName,omitempty"` + // Password - Repository user password. + Password *AsymmetricEncryptedSecret `json:"password,omitempty"` +} + +// IoTAddon ioT Addon. +type IoTAddon struct { + // IoTAddonProperties - Properties specific to IOT addon. + *IoTAddonProperties `json:"properties,omitempty"` + // SystemData - Addon type + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindAddon', 'KindArcForKubernetes', 'KindIotEdge' + Kind Kind `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTAddon. +func (ita IoTAddon) MarshalJSON() ([]byte, error) { + ita.Kind = KindIotEdge + objectMap := make(map[string]interface{}) + if ita.IoTAddonProperties != nil { + objectMap["properties"] = ita.IoTAddonProperties + } + if ita.SystemData != nil { + objectMap["systemData"] = ita.SystemData + } + if ita.Kind != "" { + objectMap["kind"] = ita.Kind + } + return json.Marshal(objectMap) +} + +// AsArcAddon is the BasicAddon implementation for IoTAddon. +func (ita IoTAddon) AsArcAddon() (*ArcAddon, bool) { + return nil, false +} + +// AsIoTAddon is the BasicAddon implementation for IoTAddon. +func (ita IoTAddon) AsIoTAddon() (*IoTAddon, bool) { + return &ita, true +} + +// AsAddon is the BasicAddon implementation for IoTAddon. +func (ita IoTAddon) AsAddon() (*Addon, bool) { + return nil, false +} + +// AsBasicAddon is the BasicAddon implementation for IoTAddon. +func (ita IoTAddon) AsBasicAddon() (BasicAddon, bool) { + return &ita, true +} + +// UnmarshalJSON is the custom unmarshaler for IoTAddon struct. +func (ita *IoTAddon) 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 "properties": + if v != nil { + var ioTAddonProperties IoTAddonProperties + err = json.Unmarshal(*v, &ioTAddonProperties) + if err != nil { + return err + } + ita.IoTAddonProperties = &ioTAddonProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ita.SystemData = &systemData + } + case "kind": + if v != nil { + var kind Kind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ita.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ita.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ita.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ita.Type = &typeVar + } + } + } + + return nil +} + +// IoTAddonProperties ioT addon properties. +type IoTAddonProperties struct { + // IoTDeviceDetails - IoT device metadata to which appliance needs to be connected. + IoTDeviceDetails *IoTDeviceInfo `json:"ioTDeviceDetails,omitempty"` + // IoTEdgeDeviceDetails - IoT edge device to which the IoT Addon needs to be configured. + IoTEdgeDeviceDetails *IoTDeviceInfo `json:"ioTEdgeDeviceDetails,omitempty"` + // Version - READ-ONLY; Version of IoT running on the appliance. + Version *string `json:"version,omitempty"` + // HostPlatform - READ-ONLY; Host OS supported by the IoT addon. Possible values include: 'Windows', 'Linux' + HostPlatform PlatformType `json:"hostPlatform,omitempty"` + // HostPlatformType - READ-ONLY; Platform where the runtime is hosted. Possible values include: 'KubernetesCluster', 'LinuxVM' + HostPlatformType HostPlatformType `json:"hostPlatformType,omitempty"` + // ProvisioningState - READ-ONLY; Addon Provisioning State. Possible values include: 'Invalid', 'Creating', 'Created', 'Updating', 'Reconfiguring', 'Failed', 'Deleting' + ProvisioningState AddonState `json:"provisioningState,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTAddonProperties. +func (itap IoTAddonProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itap.IoTDeviceDetails != nil { + objectMap["ioTDeviceDetails"] = itap.IoTDeviceDetails + } + if itap.IoTEdgeDeviceDetails != nil { + objectMap["ioTEdgeDeviceDetails"] = itap.IoTEdgeDeviceDetails + } + return json.Marshal(objectMap) +} + +// IoTDeviceInfo metadata of IoT device/IoT Edge device to be configured. +type IoTDeviceInfo struct { + // DeviceID - ID of the IoT device/edge device. + DeviceID *string `json:"deviceId,omitempty"` + // IoTHostHub - Host name for the IoT hub associated to the device. + IoTHostHub *string `json:"ioTHostHub,omitempty"` + // IoTHostHubID - Id for the IoT hub associated to the device. + IoTHostHubID *string `json:"ioTHostHubId,omitempty"` + // Authentication - Encrypted IoT device/IoT edge device connection string. + Authentication *Authentication `json:"authentication,omitempty"` +} + +// IoTEdgeAgentInfo ioT edge agent details is optional, this will be used for download system Agent module +// while bootstrapping IoT Role if specified. +type IoTEdgeAgentInfo struct { + // ImageName - Name of the IoT edge agent image. + ImageName *string `json:"imageName,omitempty"` + // Tag - Image Tag. + Tag *string `json:"tag,omitempty"` + // ImageRepository - Image repository details. + ImageRepository *ImageRepositoryCredential `json:"imageRepository,omitempty"` +} + +// IoTRole compute role. +type IoTRole struct { + // IoTRoleProperties - Properties specific to IoT role. + *IoTRoleProperties `json:"properties,omitempty"` + // SystemData - Role configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindRole', 'KindCloudEdgeManagement', 'KindIOT', 'KindKubernetes', 'KindMEC' + Kind KindBasicRole `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTRole. +func (itr IoTRole) MarshalJSON() ([]byte, error) { + itr.Kind = KindIOT + objectMap := make(map[string]interface{}) + if itr.IoTRoleProperties != nil { + objectMap["properties"] = itr.IoTRoleProperties + } + if itr.SystemData != nil { + objectMap["systemData"] = itr.SystemData + } + if itr.Kind != "" { + objectMap["kind"] = itr.Kind + } + return json.Marshal(objectMap) +} + +// AsCloudEdgeManagementRole is the BasicRole implementation for IoTRole. +func (itr IoTRole) AsCloudEdgeManagementRole() (*CloudEdgeManagementRole, bool) { + return nil, false +} + +// AsIoTRole is the BasicRole implementation for IoTRole. +func (itr IoTRole) AsIoTRole() (*IoTRole, bool) { + return &itr, true +} + +// AsKubernetesRole is the BasicRole implementation for IoTRole. +func (itr IoTRole) AsKubernetesRole() (*KubernetesRole, bool) { + return nil, false +} + +// AsMECRole is the BasicRole implementation for IoTRole. +func (itr IoTRole) AsMECRole() (*MECRole, bool) { + return nil, false +} + +// AsRole is the BasicRole implementation for IoTRole. +func (itr IoTRole) AsRole() (*Role, bool) { + return nil, false +} + +// AsBasicRole is the BasicRole implementation for IoTRole. +func (itr IoTRole) AsBasicRole() (BasicRole, bool) { + return &itr, true +} + +// UnmarshalJSON is the custom unmarshaler for IoTRole struct. +func (itr *IoTRole) 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 "properties": + if v != nil { + var ioTRoleProperties IoTRoleProperties + err = json.Unmarshal(*v, &ioTRoleProperties) + if err != nil { + return err + } + itr.IoTRoleProperties = &ioTRoleProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + itr.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicRole + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + itr.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + itr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + itr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + itr.Type = &typeVar + } + } + } + + return nil +} + +// IoTRoleProperties ioT role properties. +type IoTRoleProperties struct { + // HostPlatform - Host OS supported by the IoT role. Possible values include: 'Windows', 'Linux' + HostPlatform PlatformType `json:"hostPlatform,omitempty"` + // IoTDeviceDetails - IoT device metadata to which data box edge device needs to be connected. + IoTDeviceDetails *IoTDeviceInfo `json:"ioTDeviceDetails,omitempty"` + // IoTEdgeDeviceDetails - IoT edge device to which the IoT role needs to be configured. + IoTEdgeDeviceDetails *IoTDeviceInfo `json:"ioTEdgeDeviceDetails,omitempty"` + // ShareMappings - Mount points of shares in role(s). + ShareMappings *[]MountPointMap `json:"shareMappings,omitempty"` + // IoTEdgeAgentInfo - Iot edge agent details to download the agent and bootstrap iot runtime. + IoTEdgeAgentInfo *IoTEdgeAgentInfo `json:"ioTEdgeAgentInfo,omitempty"` + // HostPlatformType - READ-ONLY; Platform where the Iot runtime is hosted. Possible values include: 'KubernetesCluster', 'LinuxVM' + HostPlatformType HostPlatformType `json:"hostPlatformType,omitempty"` + // ComputeResource - Resource allocation + ComputeResource *ComputeResource `json:"computeResource,omitempty"` + // RoleStatus - Role status. Possible values include: 'RoleStatusEnabled', 'RoleStatusDisabled' + RoleStatus RoleStatus `json:"roleStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for IoTRoleProperties. +func (itrp IoTRoleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if itrp.HostPlatform != "" { + objectMap["hostPlatform"] = itrp.HostPlatform + } + if itrp.IoTDeviceDetails != nil { + objectMap["ioTDeviceDetails"] = itrp.IoTDeviceDetails + } + if itrp.IoTEdgeDeviceDetails != nil { + objectMap["ioTEdgeDeviceDetails"] = itrp.IoTEdgeDeviceDetails + } + if itrp.ShareMappings != nil { + objectMap["shareMappings"] = itrp.ShareMappings + } + if itrp.IoTEdgeAgentInfo != nil { + objectMap["ioTEdgeAgentInfo"] = itrp.IoTEdgeAgentInfo + } + if itrp.ComputeResource != nil { + objectMap["computeResource"] = itrp.ComputeResource + } + if itrp.RoleStatus != "" { + objectMap["roleStatus"] = itrp.RoleStatus + } + return json.Marshal(objectMap) +} + +// Ipv4Config details related to the IPv4 address configuration. +type Ipv4Config struct { + // IPAddress - READ-ONLY; The IPv4 address of the network adapter. + IPAddress *string `json:"ipAddress,omitempty"` + // Subnet - READ-ONLY; The IPv4 subnet of the network adapter. + Subnet *string `json:"subnet,omitempty"` + // Gateway - READ-ONLY; The IPv4 gateway of the network adapter. + Gateway *string `json:"gateway,omitempty"` +} + +// Ipv6Config details related to the IPv6 address configuration. +type Ipv6Config struct { + // IPAddress - READ-ONLY; The IPv6 address of the network adapter. + IPAddress *string `json:"ipAddress,omitempty"` + // PrefixLength - READ-ONLY; The IPv6 prefix of the network adapter. + PrefixLength *int32 `json:"prefixLength,omitempty"` + // Gateway - READ-ONLY; The IPv6 gateway of the network adapter. + Gateway *string `json:"gateway,omitempty"` +} + +// Job a device job. +type Job struct { + autorest.Response `json:"-"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the object. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` + // Status - READ-ONLY; The current status of the job. Possible values include: 'JobStatusInvalid', 'JobStatusRunning', 'JobStatusSucceeded', 'JobStatusFailed', 'JobStatusCanceled', 'JobStatusPaused', 'JobStatusScheduled' + Status JobStatus `json:"status,omitempty"` + // StartTime - READ-ONLY; The UTC date and time at which the job started. + StartTime *date.Time `json:"startTime,omitempty"` + // EndTime - READ-ONLY; The UTC date and time at which the job completed. + EndTime *date.Time `json:"endTime,omitempty"` + // PercentComplete - READ-ONLY; The percentage of the job that is complete. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // Error - READ-ONLY; The error details. + Error *JobErrorDetails `json:"error,omitempty"` + // JobProperties - READ-ONLY; The properties of the job. + *JobProperties `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for Job. +func (j Job) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Job struct. +func (j *Job) 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 "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + j.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + j.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + j.Type = &typeVar + } + case "status": + if v != nil { + var status JobStatus + err = json.Unmarshal(*v, &status) + if err != nil { + return err + } + j.Status = status + } + case "startTime": + if v != nil { + var startTime date.Time + err = json.Unmarshal(*v, &startTime) + if err != nil { + return err + } + j.StartTime = &startTime + } + case "endTime": + if v != nil { + var endTime date.Time + err = json.Unmarshal(*v, &endTime) + if err != nil { + return err + } + j.EndTime = &endTime + } + case "percentComplete": + if v != nil { + var percentComplete int32 + err = json.Unmarshal(*v, &percentComplete) + if err != nil { + return err + } + j.PercentComplete = &percentComplete + } + case "error": + if v != nil { + var errorVar JobErrorDetails + err = json.Unmarshal(*v, &errorVar) + if err != nil { + return err + } + j.Error = &errorVar + } + case "properties": + if v != nil { + var jobProperties JobProperties + err = json.Unmarshal(*v, &jobProperties) + if err != nil { + return err + } + j.JobProperties = &jobProperties + } + } + } + + return nil +} + +// JobErrorDetails the job error information containing the list of job errors. +type JobErrorDetails struct { + // ErrorDetails - READ-ONLY; The error details. + ErrorDetails *[]JobErrorItem `json:"errorDetails,omitempty"` + // Code - READ-ONLY; The code intended for programmatic access. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The message that describes the error in detail. + Message *string `json:"message,omitempty"` +} + +// JobErrorItem the job error items. +type JobErrorItem struct { + // Recommendations - READ-ONLY; The recommended actions. + Recommendations *[]string `json:"recommendations,omitempty"` + // Code - READ-ONLY; The code intended for programmatic access. + Code *string `json:"code,omitempty"` + // Message - READ-ONLY; The message that describes the error in detail. + Message *string `json:"message,omitempty"` +} + +// JobProperties the properties for the job. +type JobProperties struct { + // JobType - READ-ONLY; The type of the job. Possible values include: 'JobTypeInvalid', 'JobTypeScanForUpdates', 'JobTypeDownloadUpdates', 'JobTypeInstallUpdates', 'JobTypeRefreshShare', 'JobTypeRefreshContainer', 'JobTypeBackup', 'JobTypeRestore', 'JobTypeTriggerSupportPackage' + JobType JobType `json:"jobType,omitempty"` + // CurrentStage - READ-ONLY; Current stage of the update operation. Possible values include: 'UpdateOperationStageUnknown', 'UpdateOperationStageInitial', 'UpdateOperationStageScanStarted', 'UpdateOperationStageScanComplete', 'UpdateOperationStageScanFailed', 'UpdateOperationStageDownloadStarted', 'UpdateOperationStageDownloadComplete', 'UpdateOperationStageDownloadFailed', 'UpdateOperationStageInstallStarted', 'UpdateOperationStageInstallComplete', 'UpdateOperationStageInstallFailed', 'UpdateOperationStageRebootInitiated', 'UpdateOperationStageSuccess', 'UpdateOperationStageFailure', 'UpdateOperationStageRescanStarted', 'UpdateOperationStageRescanComplete', 'UpdateOperationStageRescanFailed' + CurrentStage UpdateOperationStage `json:"currentStage,omitempty"` + // DownloadProgress - READ-ONLY; The download progress. + DownloadProgress *UpdateDownloadProgress `json:"downloadProgress,omitempty"` + // InstallProgress - READ-ONLY; The install progress. + InstallProgress *UpdateInstallProgress `json:"installProgress,omitempty"` + // TotalRefreshErrors - READ-ONLY; Total number of errors encountered during the refresh process. + TotalRefreshErrors *int32 `json:"totalRefreshErrors,omitempty"` + // ErrorManifestFile - READ-ONLY; Local share/remote container relative path to the error manifest file of the refresh. + ErrorManifestFile *string `json:"errorManifestFile,omitempty"` + // RefreshedEntityID - READ-ONLY; ARM ID of the entity that was refreshed. + RefreshedEntityID *string `json:"refreshedEntityId,omitempty"` + // Folder - If only subfolders need to be refreshed, then the subfolder path inside the share or container. (The path is empty if there are no subfolders.) + Folder *string `json:"folder,omitempty"` +} + +// MarshalJSON is the custom marshaler for JobProperties. +func (jp JobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if jp.Folder != nil { + objectMap["folder"] = jp.Folder + } + return json.Marshal(objectMap) +} + +// KubernetesClusterInfo kubernetes cluster configuration +type KubernetesClusterInfo struct { + // EtcdInfo - READ-ONLY; Etcd configuration + EtcdInfo *EtcdInfo `json:"etcdInfo,omitempty"` + // Nodes - READ-ONLY; Kubernetes cluster nodes + Nodes *[]NodeInfo `json:"nodes,omitempty"` + // Version - Kubernetes cluster version + Version *string `json:"version,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesClusterInfo. +func (kci KubernetesClusterInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kci.Version != nil { + objectMap["version"] = kci.Version + } + return json.Marshal(objectMap) +} + +// KubernetesIPConfiguration kubernetes node IP configuration +type KubernetesIPConfiguration struct { + // Port - READ-ONLY; Port of the Kubernetes node. + Port *string `json:"port,omitempty"` + // IPAddress - IP address of the Kubernetes node. + IPAddress *string `json:"ipAddress,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesIPConfiguration. +func (kic KubernetesIPConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if kic.IPAddress != nil { + objectMap["ipAddress"] = kic.IPAddress + } + return json.Marshal(objectMap) +} + +// KubernetesRole kubernetes role. +type KubernetesRole struct { + // KubernetesRoleProperties - Properties specific to Kubernetes role. + *KubernetesRoleProperties `json:"properties,omitempty"` + // SystemData - Role configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindRole', 'KindCloudEdgeManagement', 'KindIOT', 'KindKubernetes', 'KindMEC' + Kind KindBasicRole `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesRole. +func (kr KubernetesRole) MarshalJSON() ([]byte, error) { + kr.Kind = KindKubernetes + objectMap := make(map[string]interface{}) + if kr.KubernetesRoleProperties != nil { + objectMap["properties"] = kr.KubernetesRoleProperties + } + if kr.SystemData != nil { + objectMap["systemData"] = kr.SystemData + } + if kr.Kind != "" { + objectMap["kind"] = kr.Kind + } + return json.Marshal(objectMap) +} + +// AsCloudEdgeManagementRole is the BasicRole implementation for KubernetesRole. +func (kr KubernetesRole) AsCloudEdgeManagementRole() (*CloudEdgeManagementRole, bool) { + return nil, false +} + +// AsIoTRole is the BasicRole implementation for KubernetesRole. +func (kr KubernetesRole) AsIoTRole() (*IoTRole, bool) { + return nil, false +} + +// AsKubernetesRole is the BasicRole implementation for KubernetesRole. +func (kr KubernetesRole) AsKubernetesRole() (*KubernetesRole, bool) { + return &kr, true +} + +// AsMECRole is the BasicRole implementation for KubernetesRole. +func (kr KubernetesRole) AsMECRole() (*MECRole, bool) { + return nil, false +} + +// AsRole is the BasicRole implementation for KubernetesRole. +func (kr KubernetesRole) AsRole() (*Role, bool) { + return nil, false +} + +// AsBasicRole is the BasicRole implementation for KubernetesRole. +func (kr KubernetesRole) AsBasicRole() (BasicRole, bool) { + return &kr, true +} + +// UnmarshalJSON is the custom unmarshaler for KubernetesRole struct. +func (kr *KubernetesRole) 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 "properties": + if v != nil { + var kubernetesRoleProperties KubernetesRoleProperties + err = json.Unmarshal(*v, &kubernetesRoleProperties) + if err != nil { + return err + } + kr.KubernetesRoleProperties = &kubernetesRoleProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + kr.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicRole + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + kr.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + kr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + kr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + kr.Type = &typeVar + } + } + } + + return nil +} + +// KubernetesRoleCompute kubernetes role compute resource +type KubernetesRoleCompute struct { + // VMProfile - VM profile + VMProfile *string `json:"vmProfile,omitempty"` + // MemoryInBytes - READ-ONLY; Memory in bytes + MemoryInBytes *int64 `json:"memoryInBytes,omitempty"` + // ProcessorCount - READ-ONLY; Processor count + ProcessorCount *int32 `json:"processorCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesRoleCompute. +func (krc KubernetesRoleCompute) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if krc.VMProfile != nil { + objectMap["vmProfile"] = krc.VMProfile + } + return json.Marshal(objectMap) +} + +// KubernetesRoleNetwork kubernetes role network resource +type KubernetesRoleNetwork struct { + // CniConfig - READ-ONLY; Cni configuration + CniConfig *CniConfig `json:"cniConfig,omitempty"` + // LoadBalancerConfig - READ-ONLY; Load balancer configuration + LoadBalancerConfig *LoadBalancerConfig `json:"loadBalancerConfig,omitempty"` +} + +// KubernetesRoleProperties kubernetes role properties. +type KubernetesRoleProperties struct { + // HostPlatform - Host OS supported by the Kubernetes role. Possible values include: 'Windows', 'Linux' + HostPlatform PlatformType `json:"hostPlatform,omitempty"` + // ProvisioningState - READ-ONLY; State of Kubernetes deployment. Possible values include: 'KubernetesStateInvalid', 'KubernetesStateCreating', 'KubernetesStateCreated', 'KubernetesStateUpdating', 'KubernetesStateReconfiguring', 'KubernetesStateFailed', 'KubernetesStateDeleting' + ProvisioningState KubernetesState `json:"provisioningState,omitempty"` + // HostPlatformType - READ-ONLY; Platform where the runtime is hosted. Possible values include: 'KubernetesCluster', 'LinuxVM' + HostPlatformType HostPlatformType `json:"hostPlatformType,omitempty"` + // KubernetesClusterInfo - Kubernetes cluster configuration + KubernetesClusterInfo *KubernetesClusterInfo `json:"kubernetesClusterInfo,omitempty"` + // KubernetesRoleResources - Kubernetes role resources + KubernetesRoleResources *KubernetesRoleResources `json:"kubernetesRoleResources,omitempty"` + // RoleStatus - Role status. Possible values include: 'RoleStatusEnabled', 'RoleStatusDisabled' + RoleStatus RoleStatus `json:"roleStatus,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesRoleProperties. +func (krp KubernetesRoleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if krp.HostPlatform != "" { + objectMap["hostPlatform"] = krp.HostPlatform + } + if krp.KubernetesClusterInfo != nil { + objectMap["kubernetesClusterInfo"] = krp.KubernetesClusterInfo + } + if krp.KubernetesRoleResources != nil { + objectMap["kubernetesRoleResources"] = krp.KubernetesRoleResources + } + if krp.RoleStatus != "" { + objectMap["roleStatus"] = krp.RoleStatus + } + return json.Marshal(objectMap) +} + +// KubernetesRoleResources kubernetes role resources +type KubernetesRoleResources struct { + // Storage - Kubernetes role storage resource + Storage *KubernetesRoleStorage `json:"storage,omitempty"` + // Compute - Kubernetes role compute resource + Compute *KubernetesRoleCompute `json:"compute,omitempty"` + // Network - READ-ONLY; Kubernetes role network resource + Network *KubernetesRoleNetwork `json:"network,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesRoleResources. +func (krr KubernetesRoleResources) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if krr.Storage != nil { + objectMap["storage"] = krr.Storage + } + if krr.Compute != nil { + objectMap["compute"] = krr.Compute + } + return json.Marshal(objectMap) +} + +// KubernetesRoleStorage kubernetes role storage resource +type KubernetesRoleStorage struct { + // StorageClasses - READ-ONLY; Kubernetes storage class info. + StorageClasses *[]KubernetesRoleStorageClassInfo `json:"storageClasses,omitempty"` + // Endpoints - Mount points of shares in role(s). + Endpoints *[]MountPointMap `json:"endpoints,omitempty"` +} + +// MarshalJSON is the custom marshaler for KubernetesRoleStorage. +func (krs KubernetesRoleStorage) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if krs.Endpoints != nil { + objectMap["endpoints"] = krs.Endpoints + } + return json.Marshal(objectMap) +} + +// KubernetesRoleStorageClassInfo kubernetes storage class info. +type KubernetesRoleStorageClassInfo struct { + // Name - READ-ONLY; Storage class name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Storage class type. + Type *string `json:"type,omitempty"` + // PosixCompliant - READ-ONLY; If provisioned storage is posix compliant. Possible values include: 'PosixComplianceStatusInvalid', 'PosixComplianceStatusEnabled', 'PosixComplianceStatusDisabled' + PosixCompliant PosixComplianceStatus `json:"posixCompliant,omitempty"` +} + +// LoadBalancerConfig load balancer configuration +type LoadBalancerConfig struct { + // Type - READ-ONLY; Load balancer type + Type *string `json:"type,omitempty"` + // Version - READ-ONLY; Load balancer version + Version *string `json:"version,omitempty"` +} + +// MECRole MEC role. +type MECRole struct { + // MECRoleProperties - Properties specific to MEC role. + *MECRoleProperties `json:"properties,omitempty"` + // SystemData - Role configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindRole', 'KindCloudEdgeManagement', 'KindIOT', 'KindKubernetes', 'KindMEC' + Kind KindBasicRole `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MECRole. +func (mr MECRole) MarshalJSON() ([]byte, error) { + mr.Kind = KindMEC + objectMap := make(map[string]interface{}) + if mr.MECRoleProperties != nil { + objectMap["properties"] = mr.MECRoleProperties + } + if mr.SystemData != nil { + objectMap["systemData"] = mr.SystemData + } + if mr.Kind != "" { + objectMap["kind"] = mr.Kind + } + return json.Marshal(objectMap) +} + +// AsCloudEdgeManagementRole is the BasicRole implementation for MECRole. +func (mr MECRole) AsCloudEdgeManagementRole() (*CloudEdgeManagementRole, bool) { + return nil, false +} + +// AsIoTRole is the BasicRole implementation for MECRole. +func (mr MECRole) AsIoTRole() (*IoTRole, bool) { + return nil, false +} + +// AsKubernetesRole is the BasicRole implementation for MECRole. +func (mr MECRole) AsKubernetesRole() (*KubernetesRole, bool) { + return nil, false +} + +// AsMECRole is the BasicRole implementation for MECRole. +func (mr MECRole) AsMECRole() (*MECRole, bool) { + return &mr, true +} + +// AsRole is the BasicRole implementation for MECRole. +func (mr MECRole) AsRole() (*Role, bool) { + return nil, false +} + +// AsBasicRole is the BasicRole implementation for MECRole. +func (mr MECRole) AsBasicRole() (BasicRole, bool) { + return &mr, true +} + +// UnmarshalJSON is the custom unmarshaler for MECRole struct. +func (mr *MECRole) 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 "properties": + if v != nil { + var mECRoleProperties MECRoleProperties + err = json.Unmarshal(*v, &mECRoleProperties) + if err != nil { + return err + } + mr.MECRoleProperties = &mECRoleProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + mr.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicRole + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + mr.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mr.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mr.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mr.Type = &typeVar + } + } + } + + return nil +} + +// MECRoleProperties MEC role properties. +type MECRoleProperties struct { + // ConnectionString - Activation key of the MEC. + ConnectionString *AsymmetricEncryptedSecret `json:"connectionString,omitempty"` + // RoleStatus - Role status. Possible values include: 'RoleStatusEnabled', 'RoleStatusDisabled' + RoleStatus RoleStatus `json:"roleStatus,omitempty"` +} + +// MetricConfiguration metric configuration. +type MetricConfiguration struct { + // ResourceID - The Resource ID on which the metrics should be pushed. + ResourceID *string `json:"resourceId,omitempty"` + // MdmAccount - The MDM account to which the counters should be pushed. + MdmAccount *string `json:"mdmAccount,omitempty"` + // MetricNameSpace - The MDM namespace to which the counters should be pushed. This is required if MDMAccount is specified + MetricNameSpace *string `json:"metricNameSpace,omitempty"` + // CounterSets - Host name for the IoT hub associated to the device. + CounterSets *[]MetricCounterSet `json:"counterSets,omitempty"` +} + +// MetricCounter the metric counter +type MetricCounter struct { + // Name - The counter name. + Name *string `json:"name,omitempty"` + // Instance - The instance from which counter should be collected. + Instance *string `json:"instance,omitempty"` + // DimensionFilter - The dimension filter. + DimensionFilter *[]MetricDimension `json:"dimensionFilter,omitempty"` + // AdditionalDimensions - The additional dimensions to be added to metric. + AdditionalDimensions *[]MetricDimension `json:"additionalDimensions,omitempty"` +} + +// MetricCounterSet the metric counter set +type MetricCounterSet struct { + // Counters - The counters that should be collected in this set. + Counters *[]MetricCounter `json:"counters,omitempty"` +} + +// MetricDimension the metric dimension +type MetricDimension struct { + // SourceType - The dimension type. + SourceType *string `json:"sourceType,omitempty"` + // SourceName - The dimension value. + SourceName *string `json:"sourceName,omitempty"` +} + +// MetricDimensionV1 metric Dimension v1. +type MetricDimensionV1 struct { + // Name - Name of the metrics dimension. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of the metrics dimension. + DisplayName *string `json:"displayName,omitempty"` + // ToBeExportedForShoebox - To be exported to shoe box. + ToBeExportedForShoebox *bool `json:"toBeExportedForShoebox,omitempty"` +} + +// MetricSpecificationV1 metric specification version 1. +type MetricSpecificationV1 struct { + // Name - Name of the metric. + Name *string `json:"name,omitempty"` + // DisplayName - Display name of the metric. + DisplayName *string `json:"displayName,omitempty"` + // DisplayDescription - Description of the metric to be displayed. + DisplayDescription *string `json:"displayDescription,omitempty"` + // Unit - Metric units. Possible values include: 'NotSpecified', 'Percent', 'Count', 'Seconds', 'Milliseconds', 'Bytes', 'BytesPerSecond', 'CountPerSecond' + Unit MetricUnit `json:"unit,omitempty"` + // AggregationType - Metric aggregation type. Possible values include: 'MetricAggregationTypeNotSpecified', 'MetricAggregationTypeNone', 'MetricAggregationTypeAverage', 'MetricAggregationTypeMinimum', 'MetricAggregationTypeMaximum', 'MetricAggregationTypeTotal', 'MetricAggregationTypeCount' + AggregationType MetricAggregationType `json:"aggregationType,omitempty"` + // Dimensions - Metric dimensions, other than default dimension which is resource. + Dimensions *[]MetricDimensionV1 `json:"dimensions,omitempty"` + // FillGapWithZero - Set true to fill the gaps with zero. + FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` + // Category - Metric category. Possible values include: 'Capacity', 'Transaction' + Category MetricCategory `json:"category,omitempty"` + // ResourceIDDimensionNameOverride - Resource name override. + ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` + // SupportedTimeGrainTypes - Support granularity of metrics. + SupportedTimeGrainTypes *[]TimeGrain `json:"supportedTimeGrainTypes,omitempty"` + // SupportedAggregationTypes - Support metric aggregation type. + SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` +} + +// MonitoringConfigCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type MonitoringConfigCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringConfigClient) (MonitoringMetricConfiguration, error) +} + +// MonitoringConfigDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type MonitoringConfigDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(MonitoringConfigClient) (autorest.Response, error) +} + +// MonitoringMetricConfiguration the metric setting details for the role +type MonitoringMetricConfiguration struct { + autorest.Response `json:"-"` + // MonitoringMetricConfigurationProperties - The metric setting properties. + *MonitoringMetricConfigurationProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for MonitoringMetricConfiguration. +func (mmc MonitoringMetricConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mmc.MonitoringMetricConfigurationProperties != nil { + objectMap["properties"] = mmc.MonitoringMetricConfigurationProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for MonitoringMetricConfiguration struct. +func (mmc *MonitoringMetricConfiguration) 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 "properties": + if v != nil { + var monitoringMetricConfigurationProperties MonitoringMetricConfigurationProperties + err = json.Unmarshal(*v, &monitoringMetricConfigurationProperties) + if err != nil { + return err + } + mmc.MonitoringMetricConfigurationProperties = &monitoringMetricConfigurationProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + mmc.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + mmc.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + mmc.Type = &typeVar + } + } + } + + return nil +} + +// MonitoringMetricConfigurationList collection of metric configurations. +type MonitoringMetricConfigurationList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of metric configurations. + Value *[]MonitoringMetricConfiguration `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MonitoringMetricConfigurationListIterator provides access to a complete listing of +// MonitoringMetricConfiguration values. +type MonitoringMetricConfigurationListIterator struct { + i int + page MonitoringMetricConfigurationListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *MonitoringMetricConfigurationListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringMetricConfigurationListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *MonitoringMetricConfigurationListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter MonitoringMetricConfigurationListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter MonitoringMetricConfigurationListIterator) Response() MonitoringMetricConfigurationList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter MonitoringMetricConfigurationListIterator) Value() MonitoringMetricConfiguration { + if !iter.page.NotDone() { + return MonitoringMetricConfiguration{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the MonitoringMetricConfigurationListIterator type. +func NewMonitoringMetricConfigurationListIterator(page MonitoringMetricConfigurationListPage) MonitoringMetricConfigurationListIterator { + return MonitoringMetricConfigurationListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (mmcl MonitoringMetricConfigurationList) IsEmpty() bool { + return mmcl.Value == nil || len(*mmcl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (mmcl MonitoringMetricConfigurationList) hasNextLink() bool { + return mmcl.NextLink != nil && len(*mmcl.NextLink) != 0 +} + +// monitoringMetricConfigurationListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (mmcl MonitoringMetricConfigurationList) monitoringMetricConfigurationListPreparer(ctx context.Context) (*http.Request, error) { + if !mmcl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(mmcl.NextLink))) +} + +// MonitoringMetricConfigurationListPage contains a page of MonitoringMetricConfiguration values. +type MonitoringMetricConfigurationListPage struct { + fn func(context.Context, MonitoringMetricConfigurationList) (MonitoringMetricConfigurationList, error) + mmcl MonitoringMetricConfigurationList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *MonitoringMetricConfigurationListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringMetricConfigurationListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.mmcl) + if err != nil { + return err + } + page.mmcl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *MonitoringMetricConfigurationListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page MonitoringMetricConfigurationListPage) NotDone() bool { + return !page.mmcl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page MonitoringMetricConfigurationListPage) Response() MonitoringMetricConfigurationList { + return page.mmcl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page MonitoringMetricConfigurationListPage) Values() []MonitoringMetricConfiguration { + if page.mmcl.IsEmpty() { + return nil + } + return *page.mmcl.Value +} + +// Creates a new instance of the MonitoringMetricConfigurationListPage type. +func NewMonitoringMetricConfigurationListPage(cur MonitoringMetricConfigurationList, getNextPage func(context.Context, MonitoringMetricConfigurationList) (MonitoringMetricConfigurationList, error)) MonitoringMetricConfigurationListPage { + return MonitoringMetricConfigurationListPage{ + fn: getNextPage, + mmcl: cur, + } +} + +// MonitoringMetricConfigurationProperties metrics properties +type MonitoringMetricConfigurationProperties struct { + // MetricConfigurations - The metrics configuration details + MetricConfigurations *[]MetricConfiguration `json:"metricConfigurations,omitempty"` +} + +// MountPointMap the share mount point. +type MountPointMap struct { + // ShareID - ID of the share mounted to the role VM. + ShareID *string `json:"shareId,omitempty"` + // RoleID - READ-ONLY; ID of the role to which share is mounted. + RoleID *string `json:"roleId,omitempty"` + // MountPoint - READ-ONLY; Mount point for the share. + MountPoint *string `json:"mountPoint,omitempty"` + // MountType - READ-ONLY; Mounting type. Possible values include: 'Volume', 'HostPath' + MountType MountType `json:"mountType,omitempty"` + // RoleType - READ-ONLY; Role type. Possible values include: 'IOT', 'ASA', 'Functions', 'Cognitive', 'MEC', 'CloudEdgeManagement', 'Kubernetes' + RoleType RoleTypes `json:"roleType,omitempty"` +} + +// MarshalJSON is the custom marshaler for MountPointMap. +func (mpm MountPointMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if mpm.ShareID != nil { + objectMap["shareId"] = mpm.ShareID + } + return json.Marshal(objectMap) +} + +// MoveRequest resource Move details +type MoveRequest struct { + // TargetResourceGroup - Target resource group ARMId + TargetResourceGroup *string `json:"targetResourceGroup,omitempty"` + // Resources - List of resources to be moved + Resources *[]string `json:"resources,omitempty"` +} + +// NetworkAdapter represents the networkAdapter on a device. +type NetworkAdapter struct { + // AdapterID - READ-ONLY; Instance ID of network adapter. + AdapterID *string `json:"adapterId,omitempty"` + // AdapterPosition - READ-ONLY; Hardware position of network adapter. + AdapterPosition *NetworkAdapterPosition `json:"adapterPosition,omitempty"` + // Index - READ-ONLY; Logical index of the adapter. + Index *int32 `json:"index,omitempty"` + // NodeID - READ-ONLY; Node ID of the network adapter. + NodeID *string `json:"nodeId,omitempty"` + // NetworkAdapterName - READ-ONLY; Network adapter name. + NetworkAdapterName *string `json:"networkAdapterName,omitempty"` + // Label - READ-ONLY; Hardware label for the adapter. + Label *string `json:"label,omitempty"` + // MacAddress - READ-ONLY; MAC address. + MacAddress *string `json:"macAddress,omitempty"` + // LinkSpeed - READ-ONLY; Link speed. + LinkSpeed *int64 `json:"linkSpeed,omitempty"` + // Status - READ-ONLY; Value indicating whether this adapter is valid. Possible values include: 'Inactive', 'Active' + Status NetworkAdapterStatus `json:"status,omitempty"` + // RdmaStatus - Value indicating whether this adapter is RDMA capable. Possible values include: 'Incapable', 'Capable' + RdmaStatus NetworkAdapterRDMAStatus `json:"rdmaStatus,omitempty"` + // DhcpStatus - Value indicating whether this adapter has DHCP enabled. Possible values include: 'NetworkAdapterDHCPStatusDisabled', 'NetworkAdapterDHCPStatusEnabled' + DhcpStatus NetworkAdapterDHCPStatus `json:"dhcpStatus,omitempty"` + // Ipv4Configuration - READ-ONLY; The IPv4 configuration of the network adapter. + Ipv4Configuration *Ipv4Config `json:"ipv4Configuration,omitempty"` + // Ipv6Configuration - READ-ONLY; The IPv6 configuration of the network adapter. + Ipv6Configuration *Ipv6Config `json:"ipv6Configuration,omitempty"` + // Ipv6LinkLocalAddress - READ-ONLY; The IPv6 local address. + Ipv6LinkLocalAddress *string `json:"ipv6LinkLocalAddress,omitempty"` + // DNSServers - READ-ONLY; The list of DNS Servers of the device. + DNSServers *[]string `json:"dnsServers,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkAdapter. +func (na NetworkAdapter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if na.RdmaStatus != "" { + objectMap["rdmaStatus"] = na.RdmaStatus + } + if na.DhcpStatus != "" { + objectMap["dhcpStatus"] = na.DhcpStatus + } + return json.Marshal(objectMap) +} + +// NetworkAdapterPosition the network adapter position. +type NetworkAdapterPosition struct { + // NetworkGroup - READ-ONLY; The network group. Possible values include: 'NetworkGroupNone', 'NetworkGroupNonRDMA', 'NetworkGroupRDMA' + NetworkGroup NetworkGroup `json:"networkGroup,omitempty"` + // Port - READ-ONLY; The port. + Port *int32 `json:"port,omitempty"` +} + +// NetworkSettings the network settings of a device. +type NetworkSettings struct { + autorest.Response `json:"-"` + // NetworkSettingsProperties - READ-ONLY; The properties of network settings of a device. + *NetworkSettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for NetworkSettings. +func (ns NetworkSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for NetworkSettings struct. +func (ns *NetworkSettings) 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 "properties": + if v != nil { + var networkSettingsProperties NetworkSettingsProperties + err = json.Unmarshal(*v, &networkSettingsProperties) + if err != nil { + return err + } + ns.NetworkSettingsProperties = &networkSettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ns.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ns.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ns.Type = &typeVar + } + } + } + + return nil +} + +// NetworkSettingsProperties the properties of network settings. +type NetworkSettingsProperties struct { + // NetworkAdapters - READ-ONLY; The network adapter list on the device. + NetworkAdapters *[]NetworkAdapter `json:"networkAdapters,omitempty"` +} + +// Node represents a single node in a Data box Edge/Gateway device +// Gateway devices, standalone Edge devices and a single node cluster Edge device will all have 1 node +// Multi-node Edge devices will have more than 1 nodes +type Node struct { + // NodeProperties - READ-ONLY; The properties of the node + *NodeProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Node. +func (n Node) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Node struct. +func (n *Node) 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 "properties": + if v != nil { + var nodeProperties NodeProperties + err = json.Unmarshal(*v, &nodeProperties) + if err != nil { + return err + } + n.NodeProperties = &nodeProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + n.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + n.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + n.Type = &typeVar + } + } + } + + return nil +} + +// NodeInfo kubernetes node info +type NodeInfo struct { + // Name - READ-ONLY; Node name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; Node type - Master/Worker. Possible values include: 'KubernetesNodeTypeInvalid', 'KubernetesNodeTypeMaster', 'KubernetesNodeTypeWorker' + Type KubernetesNodeType `json:"type,omitempty"` + // IPConfiguration - IP Configuration of the Kubernetes node. + IPConfiguration *[]KubernetesIPConfiguration `json:"ipConfiguration,omitempty"` +} + +// MarshalJSON is the custom marshaler for NodeInfo. +func (ni NodeInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ni.IPConfiguration != nil { + objectMap["ipConfiguration"] = ni.IPConfiguration + } + return json.Marshal(objectMap) +} + +// NodeList collection of Nodes. +type NodeList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of Nodes. + Value *[]Node `json:"value,omitempty"` + // NextLink - Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// MarshalJSON is the custom marshaler for NodeList. +func (nl NodeList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if nl.NextLink != nil { + objectMap["nextLink"] = nl.NextLink + } + return json.Marshal(objectMap) +} + +// NodeListIterator provides access to a complete listing of Node values. +type NodeListIterator struct { + i int + page NodeListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *NodeListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodeListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *NodeListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter NodeListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter NodeListIterator) Response() NodeList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter NodeListIterator) Value() Node { + if !iter.page.NotDone() { + return Node{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the NodeListIterator type. +func NewNodeListIterator(page NodeListPage) NodeListIterator { + return NodeListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (nl NodeList) IsEmpty() bool { + return nl.Value == nil || len(*nl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (nl NodeList) hasNextLink() bool { + return nl.NextLink != nil && len(*nl.NextLink) != 0 +} + +// nodeListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (nl NodeList) nodeListPreparer(ctx context.Context) (*http.Request, error) { + if !nl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(nl.NextLink))) +} + +// NodeListPage contains a page of Node values. +type NodeListPage struct { + fn func(context.Context, NodeList) (NodeList, error) + nl NodeList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *NodeListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodeListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.nl) + if err != nil { + return err + } + page.nl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *NodeListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page NodeListPage) NotDone() bool { + return !page.nl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page NodeListPage) Response() NodeList { + return page.nl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page NodeListPage) Values() []Node { + if page.nl.IsEmpty() { + return nil + } + return *page.nl.Value +} + +// Creates a new instance of the NodeListPage type. +func NewNodeListPage(cur NodeList, getNextPage func(context.Context, NodeList) (NodeList, error)) NodeListPage { + return NodeListPage{ + fn: getNextPage, + nl: cur, + } +} + +// NodeProperties this class represents the nodes in a highly available cluster +type NodeProperties struct { + // NodeStatus - READ-ONLY; The current status of the individual node. Possible values include: 'NodeStatusUnknown', 'NodeStatusUp', 'NodeStatusDown', 'NodeStatusRebooting', 'NodeStatusShuttingDown' + NodeStatus NodeStatus `json:"nodeStatus,omitempty"` + // NodeChassisSerialNumber - READ-ONLY; Serial number of the Chassis + NodeChassisSerialNumber *string `json:"nodeChassisSerialNumber,omitempty"` + // NodeSerialNumber - READ-ONLY; Serial number of the individual node + NodeSerialNumber *string `json:"nodeSerialNumber,omitempty"` + // NodeDisplayName - READ-ONLY; Display Name of the individual node + NodeDisplayName *string `json:"nodeDisplayName,omitempty"` + // NodeFriendlySoftwareVersion - READ-ONLY; Friendly software version name that is currently installed on the node + NodeFriendlySoftwareVersion *string `json:"nodeFriendlySoftwareVersion,omitempty"` + // NodeHcsVersion - READ-ONLY; HCS version that is currently installed on the node + NodeHcsVersion *string `json:"nodeHcsVersion,omitempty"` + // NodeInstanceID - READ-ONLY; Guid instance id of the node + NodeInstanceID *string `json:"nodeInstanceId,omitempty"` +} + +// Operation operations. +type Operation struct { + // Name - Name of the operation. + Name *string `json:"name,omitempty"` + // Display - Properties displayed for the operation. + Display *OperationDisplay `json:"display,omitempty"` + // Origin - Origin of the operation. + Origin *string `json:"origin,omitempty"` + // OperationProperties - Operation properties. + *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.Origin != nil { + objectMap["origin"] = o.Origin + } + 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 "origin": + if v != nil { + var origin string + err = json.Unmarshal(*v, &origin) + if err != nil { + return err + } + o.Origin = &origin + } + case "properties": + if v != nil { + var operationProperties OperationProperties + err = json.Unmarshal(*v, &operationProperties) + if err != nil { + return err + } + o.OperationProperties = &operationProperties + } + } + } + + return nil +} + +// OperationDisplay operation display properties. +type OperationDisplay struct { + // Provider - Provider name. + Provider *string `json:"provider,omitempty"` + // Resource - The type of resource in which the operation is performed. + Resource *string `json:"resource,omitempty"` + // Operation - Operation to be performed on the resource. + Operation *string `json:"operation,omitempty"` + // Description - Description of the operation to be performed. + Description *string `json:"description,omitempty"` +} + +// OperationProperties operation properties. +type OperationProperties struct { + // ServiceSpecification - Service specification. + ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` +} + +// OperationsList the list of operations used for the discovery of available provider operations. +type OperationsList struct { + autorest.Response `json:"-"` + // Value - The value. + Value *[]Operation `json:"value,omitempty"` + // NextLink - Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationsListIterator provides access to a complete listing of Operation values. +type OperationsListIterator struct { + i int + page OperationsListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OperationsListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationsListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationsListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OperationsListIterator) Response() OperationsList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OperationsListIterator) Value() Operation { + if !iter.page.NotDone() { + return Operation{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationsListIterator type. +func NewOperationsListIterator(page OperationsListPage) OperationsListIterator { + return OperationsListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OperationsList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OperationsList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// operationsListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OperationsList) operationsListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OperationsListPage contains a page of Operation values. +type OperationsListPage struct { + fn func(context.Context, OperationsList) (OperationsList, error) + ol OperationsList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OperationsListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OperationsListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationsListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationsListPage) Response() OperationsList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationsListPage) Values() []Operation { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OperationsListPage type. +func NewOperationsListPage(cur OperationsList, getNextPage func(context.Context, OperationsList) (OperationsList, error)) OperationsListPage { + return OperationsListPage{ + fn: getNextPage, + ol: cur, + } +} + +// Order the order details. +type Order struct { + autorest.Response `json:"-"` + // OrderProperties - The order properties. + *OrderProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Order. +func (o Order) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if o.OrderProperties != nil { + objectMap["properties"] = o.OrderProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Order struct. +func (o *Order) 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 "properties": + if v != nil { + var orderProperties OrderProperties + err = json.Unmarshal(*v, &orderProperties) + if err != nil { + return err + } + o.OrderProperties = &orderProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + o.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + o.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + o.Type = &typeVar + } + } + } + + return nil +} + +// OrderList list of order entities. +type OrderList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of orders. + Value *[]Order `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// OrderListIterator provides access to a complete listing of Order values. +type OrderListIterator struct { + i int + page OrderListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *OrderListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OrderListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OrderListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter OrderListIterator) Response() OrderList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter OrderListIterator) Value() Order { + if !iter.page.NotDone() { + return Order{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OrderListIterator type. +func NewOrderListIterator(page OrderListPage) OrderListIterator { + return OrderListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ol OrderList) IsEmpty() bool { + return ol.Value == nil || len(*ol.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ol OrderList) hasNextLink() bool { + return ol.NextLink != nil && len(*ol.NextLink) != 0 +} + +// orderListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ol OrderList) orderListPreparer(ctx context.Context) (*http.Request, error) { + if !ol.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ol.NextLink))) +} + +// OrderListPage contains a page of Order values. +type OrderListPage struct { + fn func(context.Context, OrderList) (OrderList, error) + ol OrderList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *OrderListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrderListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ol) + if err != nil { + return err + } + page.ol = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *OrderListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OrderListPage) NotDone() bool { + return !page.ol.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OrderListPage) Response() OrderList { + return page.ol +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OrderListPage) Values() []Order { + if page.ol.IsEmpty() { + return nil + } + return *page.ol.Value +} + +// Creates a new instance of the OrderListPage type. +func NewOrderListPage(cur OrderList, getNextPage func(context.Context, OrderList) (OrderList, error)) OrderListPage { + return OrderListPage{ + fn: getNextPage, + ol: cur, + } +} + +// OrderProperties order properties. +type OrderProperties struct { + // ContactInformation - The contact details. + ContactInformation *ContactDetails `json:"contactInformation,omitempty"` + // ShippingAddress - The shipping address. + ShippingAddress *Address `json:"shippingAddress,omitempty"` + // CurrentStatus - Current status of the order. + CurrentStatus *OrderStatus `json:"currentStatus,omitempty"` + // OrderHistory - READ-ONLY; List of status changes in the order. + OrderHistory *[]OrderStatus `json:"orderHistory,omitempty"` + // SerialNumber - READ-ONLY; Serial number of the device. + SerialNumber *string `json:"serialNumber,omitempty"` + // DeliveryTrackingInfo - READ-ONLY; Tracking information for the package delivered to the customer whether it has an original or a replacement device. + DeliveryTrackingInfo *[]TrackingInfo `json:"deliveryTrackingInfo,omitempty"` + // ReturnTrackingInfo - READ-ONLY; Tracking information for the package returned from the customer whether it has an original or a replacement device. + ReturnTrackingInfo *[]TrackingInfo `json:"returnTrackingInfo,omitempty"` + // ShipmentType - ShipmentType of the order. Possible values include: 'NotApplicable', 'ShippedToCustomer', 'SelfPickup' + ShipmentType ShipmentType `json:"shipmentType,omitempty"` +} + +// MarshalJSON is the custom marshaler for OrderProperties. +func (op OrderProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if op.ContactInformation != nil { + objectMap["contactInformation"] = op.ContactInformation + } + if op.ShippingAddress != nil { + objectMap["shippingAddress"] = op.ShippingAddress + } + if op.CurrentStatus != nil { + objectMap["currentStatus"] = op.CurrentStatus + } + if op.ShipmentType != "" { + objectMap["shipmentType"] = op.ShipmentType + } + return json.Marshal(objectMap) +} + +// OrdersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type OrdersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OrdersClient) (Order, error) +} + +// OrdersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type OrdersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(OrdersClient) (autorest.Response, error) +} + +// OrderStatus represents a single status change. +type OrderStatus struct { + // Status - Status of the order as per the allowed status types. Possible values include: 'Untracked', 'AwaitingFulfilment', 'AwaitingPreparation', 'AwaitingShipment', 'Shipped', 'Arriving', 'Delivered', 'ReplacementRequested', 'LostDevice', 'Declined', 'ReturnInitiated', 'AwaitingReturnShipment', 'ShippedBack', 'CollectedAtMicrosoft', 'AwaitingPickup', 'PickupCompleted', 'AwaitingDrop' + Status OrderState `json:"status,omitempty"` + // UpdateDateTime - READ-ONLY; Time of status update. + UpdateDateTime *date.Time `json:"updateDateTime,omitempty"` + // Comments - Comments related to this status change. + Comments *string `json:"comments,omitempty"` + // TrackingInformation - READ-ONLY; Tracking information related to the state in the ordering flow + TrackingInformation *TrackingInfo `json:"trackingInformation,omitempty"` + // AdditionalOrderDetails - READ-ONLY; Dictionary to hold generic information which is not stored + // by the already existing properties + AdditionalOrderDetails map[string]*string `json:"additionalOrderDetails"` +} + +// MarshalJSON is the custom marshaler for OrderStatus. +func (osVar OrderStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if osVar.Status != "" { + objectMap["status"] = osVar.Status + } + if osVar.Comments != nil { + objectMap["comments"] = osVar.Comments + } + return json.Marshal(objectMap) +} + +// PeriodicTimerEventTrigger trigger details. +type PeriodicTimerEventTrigger struct { + // PeriodicTimerProperties - Periodic timer trigger properties. + *PeriodicTimerProperties `json:"properties,omitempty"` + // SystemData - Trigger in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindTrigger', 'KindFileEvent', 'KindPeriodicTimerEvent' + Kind KindBasicTrigger `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PeriodicTimerEventTrigger. +func (ptet PeriodicTimerEventTrigger) MarshalJSON() ([]byte, error) { + ptet.Kind = KindPeriodicTimerEvent + objectMap := make(map[string]interface{}) + if ptet.PeriodicTimerProperties != nil { + objectMap["properties"] = ptet.PeriodicTimerProperties + } + if ptet.SystemData != nil { + objectMap["systemData"] = ptet.SystemData + } + if ptet.Kind != "" { + objectMap["kind"] = ptet.Kind + } + return json.Marshal(objectMap) +} + +// AsFileEventTrigger is the BasicTrigger implementation for PeriodicTimerEventTrigger. +func (ptet PeriodicTimerEventTrigger) AsFileEventTrigger() (*FileEventTrigger, bool) { + return nil, false +} + +// AsPeriodicTimerEventTrigger is the BasicTrigger implementation for PeriodicTimerEventTrigger. +func (ptet PeriodicTimerEventTrigger) AsPeriodicTimerEventTrigger() (*PeriodicTimerEventTrigger, bool) { + return &ptet, true +} + +// AsTrigger is the BasicTrigger implementation for PeriodicTimerEventTrigger. +func (ptet PeriodicTimerEventTrigger) AsTrigger() (*Trigger, bool) { + return nil, false +} + +// AsBasicTrigger is the BasicTrigger implementation for PeriodicTimerEventTrigger. +func (ptet PeriodicTimerEventTrigger) AsBasicTrigger() (BasicTrigger, bool) { + return &ptet, true +} + +// UnmarshalJSON is the custom unmarshaler for PeriodicTimerEventTrigger struct. +func (ptet *PeriodicTimerEventTrigger) 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 "properties": + if v != nil { + var periodicTimerProperties PeriodicTimerProperties + err = json.Unmarshal(*v, &periodicTimerProperties) + if err != nil { + return err + } + ptet.PeriodicTimerProperties = &periodicTimerProperties + } + case "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + ptet.SystemData = &systemData + } + case "kind": + if v != nil { + var kind KindBasicTrigger + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + ptet.Kind = kind + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ptet.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ptet.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ptet.Type = &typeVar + } + } + } + + return nil +} + +// PeriodicTimerProperties periodic timer trigger properties. +type PeriodicTimerProperties struct { + // SourceInfo - Periodic timer details. + SourceInfo *PeriodicTimerSourceInfo `json:"sourceInfo,omitempty"` + // SinkInfo - Role Sink information. + SinkInfo *RoleSinkInfo `json:"sinkInfo,omitempty"` + // CustomContextTag - A custom context tag typically used to correlate the trigger against its usage. For example, if a periodic timer trigger is intended for certain specific IoT modules in the device, the tag can be the name or the image URL of the module. + CustomContextTag *string `json:"customContextTag,omitempty"` +} + +// PeriodicTimerSourceInfo periodic timer event source. +type PeriodicTimerSourceInfo struct { + // StartTime - The time of the day that results in a valid trigger. Schedule is computed with reference to the time specified upto seconds. If timezone is not specified the time will considered to be in device timezone. The value will always be returned as UTC time. + StartTime *date.Time `json:"startTime,omitempty"` + // Schedule - Periodic frequency at which timer event needs to be raised. Supports daily, hourly, minutes, and seconds. + Schedule *string `json:"schedule,omitempty"` + // Topic - Topic where periodic events are published to IoT device. + Topic *string `json:"topic,omitempty"` +} + +// RawCertificateData raw Certificate Data. +type RawCertificateData struct { + // AuthenticationType - The authentication type. Possible values include: 'AuthenticationTypeInvalid', 'AuthenticationTypeAzureActiveDirectory' + AuthenticationType AuthenticationType `json:"authenticationType,omitempty"` + // Certificate - The base64 encoded certificate raw data. + Certificate *string `json:"certificate,omitempty"` +} + +// RefreshDetails fields for tracking refresh job on the share or container. +type RefreshDetails struct { + // InProgressRefreshJobID - If a refresh job is currently in progress on this share or container, this field indicates the ARM resource ID of that job. The field is empty if no job is in progress. + InProgressRefreshJobID *string `json:"inProgressRefreshJobId,omitempty"` + // LastCompletedRefreshJobTimeInUTC - Indicates the completed time for the last refresh job on this particular share or container, if any.This could be a failed job or a successful job. + LastCompletedRefreshJobTimeInUTC *date.Time `json:"lastCompletedRefreshJobTimeInUTC,omitempty"` + // ErrorManifestFile - Indicates the relative path of the error xml for the last refresh job on this particular share or container, if any. This could be a failed job or a successful job. + ErrorManifestFile *string `json:"errorManifestFile,omitempty"` + // LastJob - Indicates the id of the last refresh job on this particular share or container,if any. This could be a failed job or a successful job. + LastJob *string `json:"lastJob,omitempty"` +} + +// ResourceIdentity msi identity details of the resource +type ResourceIdentity struct { + // Type - Identity type. Possible values include: 'MsiIdentityTypeNone', 'MsiIdentityTypeSystemAssigned', 'MsiIdentityTypeUserAssigned' + Type MsiIdentityType `json:"type,omitempty"` + // PrincipalID - READ-ONLY; Service Principal Id backing the Msi + PrincipalID *string `json:"principalId,omitempty"` + // TenantID - READ-ONLY; Home Tenant Id + TenantID *string `json:"tenantId,omitempty"` +} + +// MarshalJSON is the custom marshaler for ResourceIdentity. +func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ri.Type != "" { + objectMap["type"] = ri.Type + } + return json.Marshal(objectMap) +} + +// ResourceMoveDetails fields for tracking resource move +type ResourceMoveDetails struct { + // OperationInProgress - Denotes whether move operation is in progress. Possible values include: 'ResourceMoveStatusNone', 'ResourceMoveStatusResourceMoveInProgress', 'ResourceMoveStatusResourceMoveFailed' + OperationInProgress ResourceMoveStatus `json:"operationInProgress,omitempty"` + // OperationInProgressLockTimeoutInUTC - Denotes the timeout of the operation to finish + OperationInProgressLockTimeoutInUTC *date.Time `json:"operationInProgressLockTimeoutInUTC,omitempty"` +} + +// ResourceTypeSku resource type Sku object +type ResourceTypeSku struct { + // ResourceType - READ-ONLY; The resource type. + ResourceType *string `json:"resourceType,omitempty"` + // Skus - READ-ONLY; The skus. + Skus *[]SkuInformation `json:"skus,omitempty"` +} + +// BasicRole compute role. +type BasicRole interface { + AsCloudEdgeManagementRole() (*CloudEdgeManagementRole, bool) + AsIoTRole() (*IoTRole, bool) + AsKubernetesRole() (*KubernetesRole, bool) + AsMECRole() (*MECRole, bool) + AsRole() (*Role, bool) +} + +// Role compute role. +type Role struct { + autorest.Response `json:"-"` + // SystemData - Role configured on ASE resource + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindRole', 'KindCloudEdgeManagement', 'KindIOT', 'KindKubernetes', 'KindMEC' + Kind KindBasicRole `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +func unmarshalBasicRole(body []byte) (BasicRole, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindCloudEdgeManagement): + var cemr CloudEdgeManagementRole + err := json.Unmarshal(body, &cemr) + return cemr, err + case string(KindIOT): + var itr IoTRole + err := json.Unmarshal(body, &itr) + return itr, err + case string(KindKubernetes): + var kr KubernetesRole + err := json.Unmarshal(body, &kr) + return kr, err + case string(KindMEC): + var mr MECRole + err := json.Unmarshal(body, &mr) + return mr, err + default: + var r Role + err := json.Unmarshal(body, &r) + return r, err + } +} +func unmarshalBasicRoleArray(body []byte) ([]BasicRole, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + rArray := make([]BasicRole, len(rawMessages)) + + for index, rawMessage := range rawMessages { + r, err := unmarshalBasicRole(*rawMessage) + if err != nil { + return nil, err + } + rArray[index] = r + } + return rArray, nil +} + +// MarshalJSON is the custom marshaler for Role. +func (r Role) MarshalJSON() ([]byte, error) { + r.Kind = KindRole + objectMap := make(map[string]interface{}) + if r.SystemData != nil { + objectMap["systemData"] = r.SystemData + } + if r.Kind != "" { + objectMap["kind"] = r.Kind + } + return json.Marshal(objectMap) +} + +// AsCloudEdgeManagementRole is the BasicRole implementation for Role. +func (r Role) AsCloudEdgeManagementRole() (*CloudEdgeManagementRole, bool) { + return nil, false +} + +// AsIoTRole is the BasicRole implementation for Role. +func (r Role) AsIoTRole() (*IoTRole, bool) { + return nil, false +} + +// AsKubernetesRole is the BasicRole implementation for Role. +func (r Role) AsKubernetesRole() (*KubernetesRole, bool) { + return nil, false +} + +// AsMECRole is the BasicRole implementation for Role. +func (r Role) AsMECRole() (*MECRole, bool) { + return nil, false +} + +// AsRole is the BasicRole implementation for Role. +func (r Role) AsRole() (*Role, bool) { + return &r, true +} + +// AsBasicRole is the BasicRole implementation for Role. +func (r Role) AsBasicRole() (BasicRole, bool) { + return &r, true +} + +// RoleList collection of all the roles on the Data Box Edge device. +type RoleList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The Value. + Value *[]BasicRole `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for RoleList struct. +func (rl *RoleList) 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 "value": + if v != nil { + value, err := unmarshalBasicRoleArray(*v) + if err != nil { + return err + } + rl.Value = &value + } + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + rl.NextLink = &nextLink + } + } + } + + return nil +} + +// RoleListIterator provides access to a complete listing of Role values. +type RoleListIterator struct { + i int + page RoleListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *RoleListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RoleListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter RoleListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter RoleListIterator) Response() RoleList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter RoleListIterator) Value() BasicRole { + if !iter.page.NotDone() { + return Role{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the RoleListIterator type. +func NewRoleListIterator(page RoleListPage) RoleListIterator { + return RoleListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (rl RoleList) IsEmpty() bool { + return rl.Value == nil || len(*rl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (rl RoleList) hasNextLink() bool { + return rl.NextLink != nil && len(*rl.NextLink) != 0 +} + +// roleListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (rl RoleList) roleListPreparer(ctx context.Context) (*http.Request, error) { + if !rl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(rl.NextLink))) +} + +// RoleListPage contains a page of BasicRole values. +type RoleListPage struct { + fn func(context.Context, RoleList) (RoleList, error) + rl RoleList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *RoleListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.rl) + if err != nil { + return err + } + page.rl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RoleListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page RoleListPage) NotDone() bool { + return !page.rl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page RoleListPage) Response() RoleList { + return page.rl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page RoleListPage) Values() []BasicRole { + if page.rl.IsEmpty() { + return nil + } + return *page.rl.Value +} + +// Creates a new instance of the RoleListPage type. +func NewRoleListPage(cur RoleList, getNextPage func(context.Context, RoleList) (RoleList, error)) RoleListPage { + return RoleListPage{ + fn: getNextPage, + rl: cur, + } +} + +// RoleModel ... +type RoleModel struct { + autorest.Response `json:"-"` + Value BasicRole `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for RoleModel struct. +func (rm *RoleModel) UnmarshalJSON(body []byte) error { + r, err := unmarshalBasicRole(body) + if err != nil { + return err + } + rm.Value = r + + return nil +} + +// RolesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type RolesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RolesClient) (RoleModel, error) +} + +// RolesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type RolesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(RolesClient) (autorest.Response, error) +} + +// RoleSinkInfo compute role against which events will be raised. +type RoleSinkInfo struct { + // RoleID - Compute role ID. + RoleID *string `json:"roleId,omitempty"` +} + +// SecuritySettings the security settings of a device. +type SecuritySettings struct { + // SecuritySettingsProperties - Properties of the security settings. + *SecuritySettingsProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for SecuritySettings. +func (ss SecuritySettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ss.SecuritySettingsProperties != nil { + objectMap["properties"] = ss.SecuritySettingsProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for SecuritySettings struct. +func (ss *SecuritySettings) 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 "properties": + if v != nil { + var securitySettingsProperties SecuritySettingsProperties + err = json.Unmarshal(*v, &securitySettingsProperties) + if err != nil { + return err + } + ss.SecuritySettingsProperties = &securitySettingsProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ss.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ss.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ss.Type = &typeVar + } + } + } + + return nil +} + +// SecuritySettingsProperties the properties of security settings. +type SecuritySettingsProperties struct { + // DeviceAdminPassword - Device administrator password as an encrypted string (encrypted using RSA PKCS #1) is used to sign into the local web UI of the device. The Actual password should have at least 8 characters that are a combination of uppercase, lowercase, numeric, and special characters. + DeviceAdminPassword *AsymmetricEncryptedSecret `json:"deviceAdminPassword,omitempty"` +} + +// ServiceSpecification service specification. +type ServiceSpecification struct { + // MetricSpecifications - Metric specification as defined by shoebox. + MetricSpecifications *[]MetricSpecificationV1 `json:"metricSpecifications,omitempty"` +} + +// Share represents a share on the Data Box Edge/Gateway device. +type Share struct { + autorest.Response `json:"-"` + // SystemData - Share on ASE device + SystemData *SystemData `json:"systemData,omitempty"` + // ShareProperties - The share properties. + *ShareProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Share. +func (s Share) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if s.SystemData != nil { + objectMap["systemData"] = s.SystemData + } + if s.ShareProperties != nil { + objectMap["properties"] = s.ShareProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Share struct. +func (s *Share) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + s.SystemData = &systemData + } + case "properties": + if v != nil { + var shareProperties ShareProperties + err = json.Unmarshal(*v, &shareProperties) + if err != nil { + return err + } + s.ShareProperties = &shareProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + s.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + s.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + s.Type = &typeVar + } + } + } + + return nil +} + +// ShareAccessRight specifies the mapping between this particular user and the type of access he has on +// shares on this device. +type ShareAccessRight struct { + // ShareID - The share ID. + ShareID *string `json:"shareId,omitempty"` + // AccessType - Type of access to be allowed on the share for this user. Possible values include: 'Change', 'Read', 'Custom' + AccessType ShareAccessType `json:"accessType,omitempty"` +} + +// ShareList collection of all the shares on the Data Box Edge/Gateway device. +type ShareList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of shares. + Value *[]Share `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// ShareListIterator provides access to a complete listing of Share values. +type ShareListIterator struct { + i int + page ShareListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *ShareListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ShareListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ShareListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter ShareListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter ShareListIterator) Response() ShareList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter ShareListIterator) Value() Share { + if !iter.page.NotDone() { + return Share{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the ShareListIterator type. +func NewShareListIterator(page ShareListPage) ShareListIterator { + return ShareListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl ShareList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sl ShareList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 +} + +// shareListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl ShareList) shareListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// ShareListPage contains a page of Share values. +type ShareListPage struct { + fn func(context.Context, ShareList) (ShareList, error) + sl ShareList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *ShareListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ShareListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ShareListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page ShareListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page ShareListPage) Response() ShareList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page ShareListPage) Values() []Share { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the ShareListPage type. +func NewShareListPage(cur ShareList, getNextPage func(context.Context, ShareList) (ShareList, error)) ShareListPage { + return ShareListPage{ + fn: getNextPage, + sl: cur, + } +} + +// ShareProperties the share properties. +type ShareProperties struct { + // Description - Description for the share. + Description *string `json:"description,omitempty"` + // ShareStatus - Current status of the share. Possible values include: 'ShareStatusOffline', 'ShareStatusUnknown', 'ShareStatusOK', 'ShareStatusUpdating', 'ShareStatusNeedsAttention' + ShareStatus ShareStatus `json:"shareStatus,omitempty"` + // MonitoringStatus - Current monitoring status of the share. Possible values include: 'Enabled', 'Disabled' + MonitoringStatus MonitoringStatus `json:"monitoringStatus,omitempty"` + // AzureContainerInfo - Azure container mapping for the share. + AzureContainerInfo *AzureContainerInfo `json:"azureContainerInfo,omitempty"` + // AccessProtocol - Access protocol to be used by the share. Possible values include: 'SMB', 'NFS' + AccessProtocol ShareAccessProtocol `json:"accessProtocol,omitempty"` + // UserAccessRights - Mapping of users and corresponding access rights on the share (required for SMB protocol). + UserAccessRights *[]UserAccessRight `json:"userAccessRights,omitempty"` + // ClientAccessRights - List of IP addresses and corresponding access rights on the share(required for NFS protocol). + ClientAccessRights *[]ClientAccessRight `json:"clientAccessRights,omitempty"` + // RefreshDetails - Details of the refresh job on this share. + RefreshDetails *RefreshDetails `json:"refreshDetails,omitempty"` + // ShareMappings - READ-ONLY; Share mount point to the role. + ShareMappings *[]MountPointMap `json:"shareMappings,omitempty"` + // DataPolicy - Data policy of the share. Possible values include: 'Cloud', 'Local' + DataPolicy DataPolicy `json:"dataPolicy,omitempty"` +} + +// MarshalJSON is the custom marshaler for ShareProperties. +func (sp ShareProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sp.Description != nil { + objectMap["description"] = sp.Description + } + if sp.ShareStatus != "" { + objectMap["shareStatus"] = sp.ShareStatus + } + if sp.MonitoringStatus != "" { + objectMap["monitoringStatus"] = sp.MonitoringStatus + } + if sp.AzureContainerInfo != nil { + objectMap["azureContainerInfo"] = sp.AzureContainerInfo + } + if sp.AccessProtocol != "" { + objectMap["accessProtocol"] = sp.AccessProtocol + } + if sp.UserAccessRights != nil { + objectMap["userAccessRights"] = sp.UserAccessRights + } + if sp.ClientAccessRights != nil { + objectMap["clientAccessRights"] = sp.ClientAccessRights + } + if sp.RefreshDetails != nil { + objectMap["refreshDetails"] = sp.RefreshDetails + } + if sp.DataPolicy != "" { + objectMap["dataPolicy"] = sp.DataPolicy + } + return json.Marshal(objectMap) +} + +// SharesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SharesCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharesClient) (Share, error) +} + +// SharesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type SharesDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharesClient) (autorest.Response, error) +} + +// SharesRefreshFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SharesRefreshFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(SharesClient) (autorest.Response, error) +} + +// Sku the SKU type. +type Sku struct { + // Name - SKU name. Possible values include: 'Gateway', 'Edge', 'TEA1Node', 'TEA1NodeUPS', 'TEA1NodeHeater', 'TEA1NodeUPSHeater', 'TEA4NodeHeater', 'TEA4NodeUPSHeater', 'TMA', 'TDC', 'TCASmall', 'GPU', 'TCALarge', 'EdgePBase', 'EdgePHigh', 'EdgePRBase', 'EdgePRBaseUPS', 'EdgeMRMini', 'RCASmall', 'RCALarge', 'RDC' + Name SkuName `json:"name,omitempty"` + // Tier - The SKU tier. This is based on the SKU name. Possible values include: 'Standard' + Tier SkuTier `json:"tier,omitempty"` +} + +// SkuCost the metadata for retrieving price info. +type SkuCost struct { + // MeterID - READ-ONLY; Used for querying price from commerce. + MeterID *string `json:"meterId,omitempty"` + // Quantity - READ-ONLY; The cost quantity. + Quantity *int64 `json:"quantity,omitempty"` + // ExtendedUnit - READ-ONLY; The extended unit. + ExtendedUnit *string `json:"extendedUnit,omitempty"` +} + +// SkuInformation sku information +type SkuInformation struct { + // Name - READ-ONLY; The sku name. + Name *string `json:"name,omitempty"` + // Tier - READ-ONLY; The sku tier. + Tier *string `json:"tier,omitempty"` + // Kind - READ-ONLY; The sku kind. + Kind *string `json:"kind,omitempty"` + // Family - READ-ONLY; The Sku family. + Family *string `json:"family,omitempty"` + // Costs - READ-ONLY; The pricing info of the Sku. + Costs *[]SkuCost `json:"costs,omitempty"` + // Locations - READ-ONLY; The locations where Sku is available. + Locations *[]string `json:"locations,omitempty"` + // LocationInfo - READ-ONLY; The locations where Sku is available with zones and sites info + LocationInfo *[]SkuLocationInfo `json:"locationInfo,omitempty"` + // RequiredQuotaIds - READ-ONLY; The required quotaIds for the sku to be available. + RequiredQuotaIds *[]string `json:"requiredQuotaIds,omitempty"` + // RequiredFeatures - READ-ONLY; The required features for the sku to be available. + RequiredFeatures *[]string `json:"requiredFeatures,omitempty"` +} + +// SkuInformationList list of SKU Information objects +type SkuInformationList struct { + // Value - READ-ONLY; List of ResourceTypeSku objects + Value *[]ResourceTypeSku `json:"value,omitempty"` + // NextLink - READ-ONLY; Links to the next set of results + NextLink *string `json:"nextLink,omitempty"` +} + +// SkuList list of SKU Information objects. +type SkuList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; List of ResourceType Sku + Value *[]SkuType `json:"value,omitempty"` + // NextLink - READ-ONLY; Links to the next set of results + NextLink *string `json:"nextLink,omitempty"` +} + +// SkuListIterator provides access to a complete listing of SkuType values. +type SkuListIterator struct { + i int + page SkuListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *SkuListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *SkuListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter SkuListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter SkuListIterator) Response() SkuList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter SkuListIterator) Value() SkuType { + if !iter.page.NotDone() { + return SkuType{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the SkuListIterator type. +func NewSkuListIterator(page SkuListPage) SkuListIterator { + return SkuListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sl SkuList) IsEmpty() bool { + return sl.Value == nil || len(*sl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sl SkuList) hasNextLink() bool { + return sl.NextLink != nil && len(*sl.NextLink) != 0 +} + +// skuListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sl SkuList) skuListPreparer(ctx context.Context) (*http.Request, error) { + if !sl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sl.NextLink))) +} + +// SkuListPage contains a page of SkuType values. +type SkuListPage struct { + fn func(context.Context, SkuList) (SkuList, error) + sl SkuList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *SkuListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SkuListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sl) + if err != nil { + return err + } + page.sl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *SkuListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page SkuListPage) NotDone() bool { + return !page.sl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page SkuListPage) Response() SkuList { + return page.sl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page SkuListPage) Values() []SkuType { + if page.sl.IsEmpty() { + return nil + } + return *page.sl.Value +} + +// Creates a new instance of the SkuListPage type. +func NewSkuListPage(cur SkuList, getNextPage func(context.Context, SkuList) (SkuList, error)) SkuListPage { + return SkuListPage{ + fn: getNextPage, + sl: cur, + } +} + +// SkuLocationInfo the location info. +type SkuLocationInfo struct { + // Location - READ-ONLY; The location. + Location *string `json:"location,omitempty"` + // Zones - READ-ONLY; The zones. + Zones *[]string `json:"zones,omitempty"` + // Sites - READ-ONLY; The sites. + Sites *[]string `json:"sites,omitempty"` +} + +// SkuType the Sku information. +type SkuType struct { + // ResourceType - READ-ONLY; The type of the resource. + ResourceType *string `json:"resourceType,omitempty"` + // Name - READ-ONLY; The Sku name. Possible values include: 'Gateway', 'Edge', 'TEA1Node', 'TEA1NodeUPS', 'TEA1NodeHeater', 'TEA1NodeUPSHeater', 'TEA4NodeHeater', 'TEA4NodeUPSHeater', 'TMA', 'TDC', 'TCASmall', 'GPU', 'TCALarge', 'EdgePBase', 'EdgePHigh', 'EdgePRBase', 'EdgePRBaseUPS', 'EdgeMRMini', 'RCASmall', 'RCALarge', 'RDC' + Name SkuName `json:"name,omitempty"` + // Kind - READ-ONLY; The Sku kind. + Kind *string `json:"kind,omitempty"` + // Tier - READ-ONLY; The Sku tier. Possible values include: 'Standard' + Tier SkuTier `json:"tier,omitempty"` + // Size - READ-ONLY; The Sku kind. + Size *string `json:"size,omitempty"` + // Family - READ-ONLY; The Sku family. + Family *string `json:"family,omitempty"` + // Locations - READ-ONLY; Availability of the Sku for the region. + Locations *[]string `json:"locations,omitempty"` + // APIVersions - READ-ONLY; The API versions in which Sku is available. + APIVersions *[]string `json:"apiVersions,omitempty"` + // LocationInfo - READ-ONLY; Availability of the Sku for the location/zone/site. + LocationInfo *[]SkuLocationInfo `json:"locationInfo,omitempty"` + // Costs - READ-ONLY; The pricing info of the Sku. + Costs *[]SkuCost `json:"costs,omitempty"` + // SignupOption - READ-ONLY; Sku can be signed up by customer or not. Possible values include: 'SkuSignupOptionNone', 'SkuSignupOptionAvailable' + SignupOption SkuSignupOption `json:"signupOption,omitempty"` + // Version - READ-ONLY; Availability of the Sku as preview/stable. Possible values include: 'Stable', 'Preview' + Version SkuVersion `json:"version,omitempty"` + // Availability - READ-ONLY; Links to the next set of results. Possible values include: 'Available', 'Unavailable' + Availability SkuAvailability `json:"availability,omitempty"` + // ShipmentTypes - READ-ONLY; List of Shipment Types supported by this SKU + ShipmentTypes *[]ShipmentType `json:"shipmentTypes,omitempty"` +} + +// StorageAccount represents a Storage Account on the Data Box Edge/Gateway device. +type StorageAccount struct { + autorest.Response `json:"-"` + // SystemData - StorageAccount object on ASE device + SystemData *SystemData `json:"systemData,omitempty"` + // StorageAccountProperties - The Storage Account properties. + *StorageAccountProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageAccount. +func (sa StorageAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sa.SystemData != nil { + objectMap["systemData"] = sa.SystemData + } + if sa.StorageAccountProperties != nil { + objectMap["properties"] = sa.StorageAccountProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageAccount struct. +func (sa *StorageAccount) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sa.SystemData = &systemData + } + case "properties": + if v != nil { + var storageAccountProperties StorageAccountProperties + err = json.Unmarshal(*v, &storageAccountProperties) + if err != nil { + return err + } + sa.StorageAccountProperties = &storageAccountProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sa.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sa.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sa.Type = &typeVar + } + } + } + + return nil +} + +// StorageAccountCredential the storage account credential. +type StorageAccountCredential struct { + autorest.Response `json:"-"` + // SystemData - StorageAccountCredential object + SystemData *SystemData `json:"systemData,omitempty"` + // StorageAccountCredentialProperties - The storage account credential properties. + *StorageAccountCredentialProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageAccountCredential. +func (sac StorageAccountCredential) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sac.SystemData != nil { + objectMap["systemData"] = sac.SystemData + } + if sac.StorageAccountCredentialProperties != nil { + objectMap["properties"] = sac.StorageAccountCredentialProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for StorageAccountCredential struct. +func (sac *StorageAccountCredential) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + sac.SystemData = &systemData + } + case "properties": + if v != nil { + var storageAccountCredentialProperties StorageAccountCredentialProperties + err = json.Unmarshal(*v, &storageAccountCredentialProperties) + if err != nil { + return err + } + sac.StorageAccountCredentialProperties = &storageAccountCredentialProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + sac.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + sac.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + sac.Type = &typeVar + } + } + } + + return nil +} + +// StorageAccountCredentialList the collection of storage account credentials. +type StorageAccountCredentialList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The value. + Value *[]StorageAccountCredential `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageAccountCredentialListIterator provides access to a complete listing of StorageAccountCredential +// values. +type StorageAccountCredentialListIterator struct { + i int + page StorageAccountCredentialListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StorageAccountCredentialListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StorageAccountCredentialListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StorageAccountCredentialListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StorageAccountCredentialListIterator) Response() StorageAccountCredentialList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StorageAccountCredentialListIterator) Value() StorageAccountCredential { + if !iter.page.NotDone() { + return StorageAccountCredential{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StorageAccountCredentialListIterator type. +func NewStorageAccountCredentialListIterator(page StorageAccountCredentialListPage) StorageAccountCredentialListIterator { + return StorageAccountCredentialListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sacl StorageAccountCredentialList) IsEmpty() bool { + return sacl.Value == nil || len(*sacl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sacl StorageAccountCredentialList) hasNextLink() bool { + return sacl.NextLink != nil && len(*sacl.NextLink) != 0 +} + +// storageAccountCredentialListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sacl StorageAccountCredentialList) storageAccountCredentialListPreparer(ctx context.Context) (*http.Request, error) { + if !sacl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sacl.NextLink))) +} + +// StorageAccountCredentialListPage contains a page of StorageAccountCredential values. +type StorageAccountCredentialListPage struct { + fn func(context.Context, StorageAccountCredentialList) (StorageAccountCredentialList, error) + sacl StorageAccountCredentialList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StorageAccountCredentialListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sacl) + if err != nil { + return err + } + page.sacl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StorageAccountCredentialListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StorageAccountCredentialListPage) NotDone() bool { + return !page.sacl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StorageAccountCredentialListPage) Response() StorageAccountCredentialList { + return page.sacl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StorageAccountCredentialListPage) Values() []StorageAccountCredential { + if page.sacl.IsEmpty() { + return nil + } + return *page.sacl.Value +} + +// Creates a new instance of the StorageAccountCredentialListPage type. +func NewStorageAccountCredentialListPage(cur StorageAccountCredentialList, getNextPage func(context.Context, StorageAccountCredentialList) (StorageAccountCredentialList, error)) StorageAccountCredentialListPage { + return StorageAccountCredentialListPage{ + fn: getNextPage, + sacl: cur, + } +} + +// StorageAccountCredentialProperties the storage account credential properties. +type StorageAccountCredentialProperties struct { + // Alias - Alias for the storage account. + Alias *string `json:"alias,omitempty"` + // UserName - Username for the storage account. + UserName *string `json:"userName,omitempty"` + // AccountKey - Encrypted storage key. + AccountKey *AsymmetricEncryptedSecret `json:"accountKey,omitempty"` + // ConnectionString - Connection string for the storage account. Use this string if username and account key are not specified. + ConnectionString *string `json:"connectionString,omitempty"` + // SslStatus - Signifies whether SSL needs to be enabled or not. Possible values include: 'SSLStatusEnabled', 'SSLStatusDisabled' + SslStatus SSLStatus `json:"sslStatus,omitempty"` + // BlobDomainName - Blob end point for private clouds. + BlobDomainName *string `json:"blobDomainName,omitempty"` + // AccountType - Type of storage accessed on the storage account. Possible values include: 'GeneralPurposeStorage', 'BlobStorage' + AccountType AccountType `json:"accountType,omitempty"` + // StorageAccountID - Id of the storage account. + StorageAccountID *string `json:"storageAccountId,omitempty"` +} + +// StorageAccountCredentialsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results +// of a long-running operation. +type StorageAccountCredentialsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageAccountCredentialsClient) (StorageAccountCredential, error) +} + +// StorageAccountCredentialsDeleteFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StorageAccountCredentialsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageAccountCredentialsClient) (autorest.Response, error) +} + +// StorageAccountList collection of all the Storage Accounts on the Data Box Edge/Gateway device. +type StorageAccountList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of storageAccounts. + Value *[]StorageAccount `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// StorageAccountListIterator provides access to a complete listing of StorageAccount values. +type StorageAccountListIterator struct { + i int + page StorageAccountListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *StorageAccountListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *StorageAccountListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter StorageAccountListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter StorageAccountListIterator) Response() StorageAccountList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter StorageAccountListIterator) Value() StorageAccount { + if !iter.page.NotDone() { + return StorageAccount{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the StorageAccountListIterator type. +func NewStorageAccountListIterator(page StorageAccountListPage) StorageAccountListIterator { + return StorageAccountListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (sal StorageAccountList) IsEmpty() bool { + return sal.Value == nil || len(*sal.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (sal StorageAccountList) hasNextLink() bool { + return sal.NextLink != nil && len(*sal.NextLink) != 0 +} + +// storageAccountListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (sal StorageAccountList) storageAccountListPreparer(ctx context.Context) (*http.Request, error) { + if !sal.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(sal.NextLink))) +} + +// StorageAccountListPage contains a page of StorageAccount values. +type StorageAccountListPage struct { + fn func(context.Context, StorageAccountList) (StorageAccountList, error) + sal StorageAccountList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *StorageAccountListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.sal) + if err != nil { + return err + } + page.sal = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *StorageAccountListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page StorageAccountListPage) NotDone() bool { + return !page.sal.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page StorageAccountListPage) Response() StorageAccountList { + return page.sal +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page StorageAccountListPage) Values() []StorageAccount { + if page.sal.IsEmpty() { + return nil + } + return *page.sal.Value +} + +// Creates a new instance of the StorageAccountListPage type. +func NewStorageAccountListPage(cur StorageAccountList, getNextPage func(context.Context, StorageAccountList) (StorageAccountList, error)) StorageAccountListPage { + return StorageAccountListPage{ + fn: getNextPage, + sal: cur, + } +} + +// StorageAccountProperties the storage account properties. +type StorageAccountProperties struct { + // Description - Description for the storage Account. + Description *string `json:"description,omitempty"` + // StorageAccountStatus - Current status of the storage account. Possible values include: 'StorageAccountStatusOK', 'StorageAccountStatusOffline', 'StorageAccountStatusUnknown', 'StorageAccountStatusUpdating', 'StorageAccountStatusNeedsAttention' + StorageAccountStatus StorageAccountStatus `json:"storageAccountStatus,omitempty"` + // DataPolicy - Data policy of the storage Account. Possible values include: 'Cloud', 'Local' + DataPolicy DataPolicy `json:"dataPolicy,omitempty"` + // StorageAccountCredentialID - Storage Account Credential Id + StorageAccountCredentialID *string `json:"storageAccountCredentialId,omitempty"` + // BlobEndpoint - READ-ONLY; BlobEndpoint of Storage Account + BlobEndpoint *string `json:"blobEndpoint,omitempty"` + // ContainerCount - READ-ONLY; The Container Count. Present only for Storage Accounts with DataPolicy set to Cloud. + ContainerCount *int32 `json:"containerCount,omitempty"` +} + +// MarshalJSON is the custom marshaler for StorageAccountProperties. +func (sap StorageAccountProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if sap.Description != nil { + objectMap["description"] = sap.Description + } + if sap.StorageAccountStatus != "" { + objectMap["storageAccountStatus"] = sap.StorageAccountStatus + } + if sap.DataPolicy != "" { + objectMap["dataPolicy"] = sap.DataPolicy + } + if sap.StorageAccountCredentialID != nil { + objectMap["storageAccountCredentialId"] = sap.StorageAccountCredentialID + } + return json.Marshal(objectMap) +} + +// StorageAccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type StorageAccountsCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageAccountsClient) (StorageAccount, error) +} + +// StorageAccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type StorageAccountsDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(StorageAccountsClient) (autorest.Response, error) +} + +// SubscriptionProperties ... +type SubscriptionProperties struct { + TenantID *string `json:"tenantId,omitempty"` + LocationPlacementID *string `json:"locationPlacementId,omitempty"` + QuotaID *string `json:"quotaId,omitempty"` + SerializedDetails *string `json:"serializedDetails,omitempty"` + RegisteredFeatures *[]SubscriptionRegisteredFeatures `json:"registeredFeatures,omitempty"` +} + +// SubscriptionRegisteredFeatures ... +type SubscriptionRegisteredFeatures struct { + Name *string `json:"name,omitempty"` + State *string `json:"state,omitempty"` +} + +// SymmetricKey symmetric key for authentication. +type SymmetricKey struct { + // ConnectionString - Connection string based on the symmetric key. + ConnectionString *AsymmetricEncryptedSecret `json:"connectionString,omitempty"` +} + +// 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + 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: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' + LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` + // LastModifiedAt - The type of identity that last modified the resource. + LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` +} + +// TrackingInfo tracking courier information. +type TrackingInfo struct { + // SerialNumber - Serial number of the device being tracked. + SerialNumber *string `json:"serialNumber,omitempty"` + // CarrierName - Name of the carrier used in the delivery. + CarrierName *string `json:"carrierName,omitempty"` + // TrackingID - Tracking ID of the shipment. + TrackingID *string `json:"trackingId,omitempty"` + // TrackingURL - Tracking URL of the shipment. + TrackingURL *string `json:"trackingUrl,omitempty"` +} + +// BasicTrigger trigger details. +type BasicTrigger interface { + AsFileEventTrigger() (*FileEventTrigger, bool) + AsPeriodicTimerEventTrigger() (*PeriodicTimerEventTrigger, bool) + AsTrigger() (*Trigger, bool) +} + +// Trigger trigger details. +type Trigger struct { + autorest.Response `json:"-"` + // SystemData - Trigger in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty"` + // Kind - Possible values include: 'KindTrigger', 'KindFileEvent', 'KindPeriodicTimerEvent' + Kind KindBasicTrigger `json:"kind,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +func unmarshalBasicTrigger(body []byte) (BasicTrigger, error) { + var m map[string]interface{} + err := json.Unmarshal(body, &m) + if err != nil { + return nil, err + } + + switch m["kind"] { + case string(KindFileEvent): + var fet FileEventTrigger + err := json.Unmarshal(body, &fet) + return fet, err + case string(KindPeriodicTimerEvent): + var ptet PeriodicTimerEventTrigger + err := json.Unmarshal(body, &ptet) + return ptet, err + default: + var t Trigger + err := json.Unmarshal(body, &t) + return t, err + } +} +func unmarshalBasicTriggerArray(body []byte) ([]BasicTrigger, error) { + var rawMessages []*json.RawMessage + err := json.Unmarshal(body, &rawMessages) + if err != nil { + return nil, err + } + + tArray := make([]BasicTrigger, len(rawMessages)) + + for index, rawMessage := range rawMessages { + t, err := unmarshalBasicTrigger(*rawMessage) + if err != nil { + return nil, err + } + tArray[index] = t + } + return tArray, nil +} + +// MarshalJSON is the custom marshaler for Trigger. +func (t Trigger) MarshalJSON() ([]byte, error) { + t.Kind = KindTrigger + objectMap := make(map[string]interface{}) + if t.SystemData != nil { + objectMap["systemData"] = t.SystemData + } + if t.Kind != "" { + objectMap["kind"] = t.Kind + } + return json.Marshal(objectMap) +} + +// AsFileEventTrigger is the BasicTrigger implementation for Trigger. +func (t Trigger) AsFileEventTrigger() (*FileEventTrigger, bool) { + return nil, false +} + +// AsPeriodicTimerEventTrigger is the BasicTrigger implementation for Trigger. +func (t Trigger) AsPeriodicTimerEventTrigger() (*PeriodicTimerEventTrigger, bool) { + return nil, false +} + +// AsTrigger is the BasicTrigger implementation for Trigger. +func (t Trigger) AsTrigger() (*Trigger, bool) { + return &t, true +} + +// AsBasicTrigger is the BasicTrigger implementation for Trigger. +func (t Trigger) AsBasicTrigger() (BasicTrigger, bool) { + return &t, true +} + +// TriggerList collection of all trigger on the data box edge device. +type TriggerList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of triggers. + Value *[]BasicTrigger `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TriggerList struct. +func (tl *TriggerList) 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 "value": + if v != nil { + value, err := unmarshalBasicTriggerArray(*v) + if err != nil { + return err + } + tl.Value = &value + } + case "nextLink": + if v != nil { + var nextLink string + err = json.Unmarshal(*v, &nextLink) + if err != nil { + return err + } + tl.NextLink = &nextLink + } + } + } + + return nil +} + +// TriggerListIterator provides access to a complete listing of Trigger values. +type TriggerListIterator struct { + i int + page TriggerListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *TriggerListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggerListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *TriggerListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter TriggerListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter TriggerListIterator) Response() TriggerList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter TriggerListIterator) Value() BasicTrigger { + if !iter.page.NotDone() { + return Trigger{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the TriggerListIterator type. +func NewTriggerListIterator(page TriggerListPage) TriggerListIterator { + return TriggerListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (tl TriggerList) IsEmpty() bool { + return tl.Value == nil || len(*tl.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (tl TriggerList) hasNextLink() bool { + return tl.NextLink != nil && len(*tl.NextLink) != 0 +} + +// triggerListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (tl TriggerList) triggerListPreparer(ctx context.Context) (*http.Request, error) { + if !tl.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(tl.NextLink))) +} + +// TriggerListPage contains a page of BasicTrigger values. +type TriggerListPage struct { + fn func(context.Context, TriggerList) (TriggerList, error) + tl TriggerList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *TriggerListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggerListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.tl) + if err != nil { + return err + } + page.tl = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *TriggerListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page TriggerListPage) NotDone() bool { + return !page.tl.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page TriggerListPage) Response() TriggerList { + return page.tl +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page TriggerListPage) Values() []BasicTrigger { + if page.tl.IsEmpty() { + return nil + } + return *page.tl.Value +} + +// Creates a new instance of the TriggerListPage type. +func NewTriggerListPage(cur TriggerList, getNextPage func(context.Context, TriggerList) (TriggerList, error)) TriggerListPage { + return TriggerListPage{ + fn: getNextPage, + tl: cur, + } +} + +// TriggerModel ... +type TriggerModel struct { + autorest.Response `json:"-"` + Value BasicTrigger `json:"value,omitempty"` +} + +// UnmarshalJSON is the custom unmarshaler for TriggerModel struct. +func (tm *TriggerModel) UnmarshalJSON(body []byte) error { + t, err := unmarshalBasicTrigger(body) + if err != nil { + return err + } + tm.Value = t + + return nil +} + +// TriggersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TriggersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TriggersClient) (TriggerModel, error) +} + +// TriggersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type TriggersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(TriggersClient) (autorest.Response, error) +} + +// UpdateDownloadProgress details about the download progress of update. +type UpdateDownloadProgress struct { + // DownloadPhase - READ-ONLY; The download phase. Possible values include: 'Unknown', 'Initializing', 'Downloading', 'Verifying' + DownloadPhase DownloadPhase `json:"downloadPhase,omitempty"` + // PercentComplete - READ-ONLY; Percentage of completion. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // TotalBytesToDownload - READ-ONLY; Total bytes to download. + TotalBytesToDownload *float64 `json:"totalBytesToDownload,omitempty"` + // TotalBytesDownloaded - READ-ONLY; Total bytes downloaded. + TotalBytesDownloaded *float64 `json:"totalBytesDownloaded,omitempty"` + // NumberOfUpdatesToDownload - READ-ONLY; Number of updates to download. + NumberOfUpdatesToDownload *int32 `json:"numberOfUpdatesToDownload,omitempty"` + // NumberOfUpdatesDownloaded - READ-ONLY; Number of updates downloaded. + NumberOfUpdatesDownloaded *int32 `json:"numberOfUpdatesDownloaded,omitempty"` +} + +// UpdateInstallProgress progress details during installation of updates. +type UpdateInstallProgress struct { + // PercentComplete - READ-ONLY; Percentage completed. + PercentComplete *int32 `json:"percentComplete,omitempty"` + // NumberOfUpdatesToInstall - READ-ONLY; Number of updates to install. + NumberOfUpdatesToInstall *int32 `json:"numberOfUpdatesToInstall,omitempty"` + // NumberOfUpdatesInstalled - READ-ONLY; Number of updates installed. + NumberOfUpdatesInstalled *int32 `json:"numberOfUpdatesInstalled,omitempty"` +} + +// UpdateSummary details about ongoing updates and availability of updates on the device. +type UpdateSummary struct { + autorest.Response `json:"-"` + // UpdateSummaryProperties - The device update information summary. + *UpdateSummaryProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for UpdateSummary. +func (us UpdateSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if us.UpdateSummaryProperties != nil { + objectMap["properties"] = us.UpdateSummaryProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for UpdateSummary struct. +func (us *UpdateSummary) 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 "properties": + if v != nil { + var updateSummaryProperties UpdateSummaryProperties + err = json.Unmarshal(*v, &updateSummaryProperties) + if err != nil { + return err + } + us.UpdateSummaryProperties = &updateSummaryProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + us.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + us.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + us.Type = &typeVar + } + } + } + + return nil +} + +// UpdateSummaryProperties the device update information summary. +type UpdateSummaryProperties struct { + // DeviceVersionNumber - The current version of the device in format: 1.2.17312.13.", + DeviceVersionNumber *string `json:"deviceVersionNumber,omitempty"` + // FriendlyDeviceVersionName - The current version of the device in text format. + FriendlyDeviceVersionName *string `json:"friendlyDeviceVersionName,omitempty"` + // DeviceLastScannedDateTime - The last time when a scan was done on the device. + DeviceLastScannedDateTime *date.Time `json:"deviceLastScannedDateTime,omitempty"` + // LastCompletedScanJobDateTime - The time when the last scan job was completed (success/cancelled/failed) on the appliance. + LastCompletedScanJobDateTime *date.Time `json:"lastCompletedScanJobDateTime,omitempty"` + // LastCompletedDownloadJobDateTime - READ-ONLY; The time when the last Download job was completed (success/cancelled/failed) on the appliance. + LastCompletedDownloadJobDateTime *date.Time `json:"lastCompletedDownloadJobDateTime,omitempty"` + // LastCompletedInstallJobDateTime - READ-ONLY; The time when the last Install job was completed (success/cancelled/failed) on the appliance. + LastCompletedInstallJobDateTime *date.Time `json:"lastCompletedInstallJobDateTime,omitempty"` + // TotalNumberOfUpdatesAvailable - READ-ONLY; The number of updates available for the current device version as per the last device scan. + TotalNumberOfUpdatesAvailable *int32 `json:"totalNumberOfUpdatesAvailable,omitempty"` + // TotalNumberOfUpdatesPendingDownload - READ-ONLY; The total number of items pending download. + TotalNumberOfUpdatesPendingDownload *int32 `json:"totalNumberOfUpdatesPendingDownload,omitempty"` + // TotalNumberOfUpdatesPendingInstall - READ-ONLY; The total number of items pending install. + TotalNumberOfUpdatesPendingInstall *int32 `json:"totalNumberOfUpdatesPendingInstall,omitempty"` + // RebootBehavior - READ-ONLY; Indicates if updates are available and at least one of the updates needs a reboot. Possible values include: 'NeverReboots', 'RequiresReboot', 'RequestReboot' + RebootBehavior InstallRebootBehavior `json:"rebootBehavior,omitempty"` + // OngoingUpdateOperation - READ-ONLY; The current update operation. Possible values include: 'UpdateOperationNone', 'UpdateOperationScan', 'UpdateOperationDownload', 'UpdateOperationInstall' + OngoingUpdateOperation UpdateOperation `json:"ongoingUpdateOperation,omitempty"` + // InProgressDownloadJobID - READ-ONLY; The job ID of the download job in progress. + InProgressDownloadJobID *string `json:"inProgressDownloadJobId,omitempty"` + // InProgressInstallJobID - READ-ONLY; The job ID of the install job in progress. + InProgressInstallJobID *string `json:"inProgressInstallJobId,omitempty"` + // InProgressDownloadJobStartedDateTime - READ-ONLY; The time when the currently running download (if any) started. + InProgressDownloadJobStartedDateTime *date.Time `json:"inProgressDownloadJobStartedDateTime,omitempty"` + // InProgressInstallJobStartedDateTime - READ-ONLY; The time when the currently running install (if any) started. + InProgressInstallJobStartedDateTime *date.Time `json:"inProgressInstallJobStartedDateTime,omitempty"` + // UpdateTitles - READ-ONLY; The list of updates available for install. + UpdateTitles *[]string `json:"updateTitles,omitempty"` + // TotalUpdateSizeInBytes - READ-ONLY; The total size of updates available for download in bytes. + TotalUpdateSizeInBytes *float64 `json:"totalUpdateSizeInBytes,omitempty"` +} + +// MarshalJSON is the custom marshaler for UpdateSummaryProperties. +func (usp UpdateSummaryProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if usp.DeviceVersionNumber != nil { + objectMap["deviceVersionNumber"] = usp.DeviceVersionNumber + } + if usp.FriendlyDeviceVersionName != nil { + objectMap["friendlyDeviceVersionName"] = usp.FriendlyDeviceVersionName + } + if usp.DeviceLastScannedDateTime != nil { + objectMap["deviceLastScannedDateTime"] = usp.DeviceLastScannedDateTime + } + if usp.LastCompletedScanJobDateTime != nil { + objectMap["lastCompletedScanJobDateTime"] = usp.LastCompletedScanJobDateTime + } + return json.Marshal(objectMap) +} + +// UploadCertificateRequest the upload certificate request. +type UploadCertificateRequest struct { + // RawCertificateData - The Base 64 encoded certificate raw data. + *RawCertificateData `json:"properties,omitempty"` +} + +// MarshalJSON is the custom marshaler for UploadCertificateRequest. +func (ucr UploadCertificateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ucr.RawCertificateData != nil { + objectMap["properties"] = ucr.RawCertificateData + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for UploadCertificateRequest struct. +func (ucr *UploadCertificateRequest) 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 "properties": + if v != nil { + var rawCertificateData RawCertificateData + err = json.Unmarshal(*v, &rawCertificateData) + if err != nil { + return err + } + ucr.RawCertificateData = &rawCertificateData + } + } + } + + return nil +} + +// UploadCertificateResponse the upload registration certificate response. +type UploadCertificateResponse struct { + autorest.Response `json:"-"` + // AuthType - Specifies authentication type. Possible values include: 'AuthenticationTypeInvalid', 'AuthenticationTypeAzureActiveDirectory' + AuthType AuthenticationType `json:"authType,omitempty"` + // ResourceID - READ-ONLY; The resource ID of the Data Box Edge/Gateway device. + ResourceID *string `json:"resourceId,omitempty"` + // AadAuthority - READ-ONLY; Azure Active Directory tenant authority. + AadAuthority *string `json:"aadAuthority,omitempty"` + // AadTenantID - READ-ONLY; Azure Active Directory tenant ID. + AadTenantID *string `json:"aadTenantId,omitempty"` + // ServicePrincipalClientID - READ-ONLY; Azure Active Directory service principal client ID. + ServicePrincipalClientID *string `json:"servicePrincipalClientId,omitempty"` + // ServicePrincipalObjectID - READ-ONLY; Azure Active Directory service principal object ID. + ServicePrincipalObjectID *string `json:"servicePrincipalObjectId,omitempty"` + // AzureManagementEndpointAudience - READ-ONLY; The azure management endpoint audience. + AzureManagementEndpointAudience *string `json:"azureManagementEndpointAudience,omitempty"` + // AadAudience - READ-ONLY; Identifier of the target resource that is the recipient of the requested token. + AadAudience *string `json:"aadAudience,omitempty"` +} + +// MarshalJSON is the custom marshaler for UploadCertificateResponse. +func (ucr UploadCertificateResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ucr.AuthType != "" { + objectMap["authType"] = ucr.AuthType + } + return json.Marshal(objectMap) +} + +// User represents a user who has access to one or more shares on the Data Box Edge/Gateway device. +type User struct { + autorest.Response `json:"-"` + // SystemData - User in DataBoxEdge Resource + SystemData *SystemData `json:"systemData,omitempty"` + // UserProperties - The storage account credential properties. + *UserProperties `json:"properties,omitempty"` + // ID - READ-ONLY; The path ID that uniquely identifies the object. + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The object name. + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The hierarchical type of the object. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for User. +func (u User) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if u.SystemData != nil { + objectMap["systemData"] = u.SystemData + } + if u.UserProperties != nil { + objectMap["properties"] = u.UserProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for User struct. +func (u *User) 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 "systemData": + if v != nil { + var systemData SystemData + err = json.Unmarshal(*v, &systemData) + if err != nil { + return err + } + u.SystemData = &systemData + } + case "properties": + if v != nil { + var userProperties UserProperties + err = json.Unmarshal(*v, &userProperties) + if err != nil { + return err + } + u.UserProperties = &userProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + u.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + u.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + u.Type = &typeVar + } + } + } + + return nil +} + +// UserAccessRight the mapping between a particular user and the access type on the SMB share. +type UserAccessRight struct { + // UserID - User ID (already existing in the device). + UserID *string `json:"userId,omitempty"` + // AccessType - Type of access to be allowed for the user. Possible values include: 'Change', 'Read', 'Custom' + AccessType ShareAccessType `json:"accessType,omitempty"` +} + +// UserList collection of users. +type UserList struct { + autorest.Response `json:"-"` + // Value - READ-ONLY; The list of users. + Value *[]User `json:"value,omitempty"` + // NextLink - READ-ONLY; Link to the next set of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// UserListIterator provides access to a complete listing of User values. +type UserListIterator struct { + i int + page UserListPage +} + +// NextWithContext advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +func (iter *UserListIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserListIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *UserListIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter UserListIterator) NotDone() bool { + return iter.page.NotDone() && iter.i < len(iter.page.Values()) +} + +// Response returns the raw server response from the last page request. +func (iter UserListIterator) Response() UserList { + return iter.page.Response() +} + +// Value returns the current value or a zero-initialized value if the +// iterator has advanced beyond the end of the collection. +func (iter UserListIterator) Value() User { + if !iter.page.NotDone() { + return User{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the UserListIterator type. +func NewUserListIterator(page UserListPage) UserListIterator { + return UserListIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (ul UserList) IsEmpty() bool { + return ul.Value == nil || len(*ul.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (ul UserList) hasNextLink() bool { + return ul.NextLink != nil && len(*ul.NextLink) != 0 +} + +// userListPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (ul UserList) userListPreparer(ctx context.Context) (*http.Request, error) { + if !ul.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(ul.NextLink))) +} + +// UserListPage contains a page of User values. +type UserListPage struct { + fn func(context.Context, UserList) (UserList, error) + ul UserList +} + +// NextWithContext advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +func (page *UserListPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UserListPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.ul) + if err != nil { + return err + } + page.ul = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + return nil +} + +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *UserListPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page UserListPage) NotDone() bool { + return !page.ul.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page UserListPage) Response() UserList { + return page.ul +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page UserListPage) Values() []User { + if page.ul.IsEmpty() { + return nil + } + return *page.ul.Value +} + +// Creates a new instance of the UserListPage type. +func NewUserListPage(cur UserList, getNextPage func(context.Context, UserList) (UserList, error)) UserListPage { + return UserListPage{ + fn: getNextPage, + ul: cur, + } +} + +// UserProperties the user properties. +type UserProperties struct { + // EncryptedPassword - The password details. + EncryptedPassword *AsymmetricEncryptedSecret `json:"encryptedPassword,omitempty"` + // ShareAccessRights - READ-ONLY; List of shares that the user has rights on. This field should not be specified during user creation. + ShareAccessRights *[]ShareAccessRight `json:"shareAccessRights,omitempty"` + // UserType - Type of the user. Possible values include: 'UserTypeShare', 'UserTypeLocalManagement', 'UserTypeARM' + UserType UserType `json:"userType,omitempty"` +} + +// MarshalJSON is the custom marshaler for UserProperties. +func (up UserProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if up.EncryptedPassword != nil { + objectMap["encryptedPassword"] = up.EncryptedPassword + } + if up.UserType != "" { + objectMap["userType"] = up.UserType + } + return json.Marshal(objectMap) +} + +// UsersCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type UsersCreateOrUpdateFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(UsersClient) (User, error) +} + +// UsersDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. +type UsersDeleteFuture struct { + azure.FutureAPI + // Result returns the result of the asynchronous operation. + // If the operation has not completed it will return an error. + Result func(UsersClient) (autorest.Response, error) +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/monitoringconfig.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/monitoringconfig.go new file mode 100644 index 000000000000..cd01e4c06372 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/monitoringconfig.go @@ -0,0 +1,443 @@ +package databoxedge + +// 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" +) + +// MonitoringConfigClient is the client for the MonitoringConfig methods of the Databoxedge service. +type MonitoringConfigClient struct { + BaseClient +} + +// NewMonitoringConfigClient creates an instance of the MonitoringConfigClient client. +func NewMonitoringConfigClient(subscriptionID string) MonitoringConfigClient { + return NewMonitoringConfigClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewMonitoringConfigClientWithBaseURI creates an instance of the MonitoringConfigClient 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 NewMonitoringConfigClientWithBaseURI(baseURI string, subscriptionID string) MonitoringConfigClient { + return MonitoringConfigClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// monitoringMetricConfiguration - the metric configuration. +// resourceGroupName - the resource group name. +func (client MonitoringConfigClient) CreateOrUpdate(ctx context.Context, deviceName string, roleName string, monitoringMetricConfiguration MonitoringMetricConfiguration, resourceGroupName string) (result MonitoringConfigCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringConfigClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: monitoringMetricConfiguration, + Constraints: []validation.Constraint{{Target: "monitoringMetricConfiguration.MonitoringMetricConfigurationProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "monitoringMetricConfiguration.MonitoringMetricConfigurationProperties.MetricConfigurations", Name: validation.Null, Rule: true, Chain: nil}}}}}}); err != nil { + return result, validation.NewError("databoxedge.MonitoringConfigClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, roleName, monitoringMetricConfiguration, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client MonitoringConfigClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, roleName string, monitoringMetricConfiguration MonitoringMetricConfiguration, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/default", pathParameters), + autorest.WithJSON(monitoringMetricConfiguration), + 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 MonitoringConfigClient) CreateOrUpdateSender(req *http.Request) (future MonitoringConfigCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client MonitoringConfigClient) (mmc MonitoringMetricConfiguration, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.MonitoringConfigCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if mmc.Response.Response, err = future.GetResult(sender); err == nil && mmc.Response.Response.StatusCode != http.StatusNoContent { + mmc, err = client.CreateOrUpdateResponder(mmc.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigCreateOrUpdateFuture", "Result", mmc.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client MonitoringConfigClient) CreateOrUpdateResponder(resp *http.Response) (result MonitoringMetricConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// resourceGroupName - the resource group name. +func (client MonitoringConfigClient) Delete(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result MonitoringConfigDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringConfigClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, roleName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client MonitoringConfigClient) DeletePreparer(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/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 MonitoringConfigClient) DeleteSender(req *http.Request) (future MonitoringConfigDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client MonitoringConfigClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.MonitoringConfigDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client MonitoringConfigClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// resourceGroupName - the resource group name. +func (client MonitoringConfigClient) Get(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result MonitoringMetricConfiguration, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringConfigClient.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, deviceName, roleName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client MonitoringConfigClient) GetPreparer(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig/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 MonitoringConfigClient) 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 MonitoringConfigClient) GetResponder(resp *http.Response) (result MonitoringMetricConfiguration, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List sends the list request. +// Parameters: +// deviceName - the device name. +// roleName - the role name. +// resourceGroupName - the resource group name. +func (client MonitoringConfigClient) List(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result MonitoringMetricConfigurationListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringConfigClient.List") + defer func() { + sc := -1 + if result.mmcl.Response.Response != nil { + sc = result.mmcl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, deviceName, roleName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.mmcl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "List", resp, "Failure sending request") + return + } + + result.mmcl, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "List", resp, "Failure responding to request") + return + } + if result.mmcl.hasNextLink() && result.mmcl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client MonitoringConfigClient) ListPreparer(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "roleName": autorest.Encode("path", roleName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{roleName}/monitoringConfig", 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 MonitoringConfigClient) 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 MonitoringConfigClient) ListResponder(resp *http.Response) (result MonitoringMetricConfigurationList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client MonitoringConfigClient) listNextResults(ctx context.Context, lastResults MonitoringMetricConfigurationList) (result MonitoringMetricConfigurationList, err error) { + req, err := lastResults.monitoringMetricConfigurationListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.MonitoringConfigClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client MonitoringConfigClient) ListComplete(ctx context.Context, deviceName string, roleName string, resourceGroupName string) (result MonitoringMetricConfigurationListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/MonitoringConfigClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx, deviceName, roleName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/nodes.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/nodes.go new file mode 100644 index 000000000000..8bfbcb1c6d3a --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/nodes.go @@ -0,0 +1,160 @@ +package databoxedge + +// 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" +) + +// NodesClient is the client for the Nodes methods of the Databoxedge service. +type NodesClient struct { + BaseClient +} + +// NewNodesClient creates an instance of the NodesClient client. +func NewNodesClient(subscriptionID string) NodesClient { + return NewNodesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewNodesClientWithBaseURI creates an instance of the NodesClient 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 NewNodesClientWithBaseURI(baseURI string, subscriptionID string) NodesClient { + return NodesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByDataBoxEdgeDevice gets all the nodes currently configured under this Data Box Edge device +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client NodesClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result NodeListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.nl.Response.Response != nil { + sc = result.nl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.NodesClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.nl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.NodesClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.nl, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.NodesClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.nl.hasNextLink() && result.nl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client NodesClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/nodes", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client NodesClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client NodesClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result NodeList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client NodesClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults NodeList) (result NodeList, err error) { + req, err := lastResults.nodeListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.NodesClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.NodesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.NodesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client NodesClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result NodeListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/NodesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operations.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operations.go new file mode 100644 index 000000000000..1a7b35358e4c --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operations.go @@ -0,0 +1,151 @@ +package databoxedge + +// 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" +) + +// OperationsClient is the client for the Operations methods of the Databoxedge service. +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 sends the list request. +func (client OperationsClient) List(ctx context.Context) (result OperationsListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.OperationsClient", "List", resp, "Failure sending request") + return + } + + result.ol, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OperationsClient", "List", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListPreparer prepares the List request. +func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.DataBoxEdge/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 OperationsList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client OperationsClient) listNextResults(ctx context.Context, lastResults OperationsList) (result OperationsList, err error) { + req, err := lastResults.operationsListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.OperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.OperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client OperationsClient) ListComplete(ctx context.Context) (result OperationsListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operationsstatus.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operationsstatus.go new file mode 100644 index 000000000000..9a9ae5c29449 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/operationsstatus.go @@ -0,0 +1,121 @@ +package databoxedge + +// 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" +) + +// OperationsStatusClient is the client for the OperationsStatus methods of the Databoxedge service. +type OperationsStatusClient struct { + BaseClient +} + +// NewOperationsStatusClient creates an instance of the OperationsStatusClient client. +func NewOperationsStatusClient(subscriptionID string) OperationsStatusClient { + return NewOperationsStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOperationsStatusClientWithBaseURI creates an instance of the OperationsStatusClient 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 NewOperationsStatusClientWithBaseURI(baseURI string, subscriptionID string) OperationsStatusClient { + return OperationsStatusClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// name - the job name. +// resourceGroupName - the resource group name. +func (client OperationsStatusClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result Job, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationsStatusClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OperationsStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.OperationsStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OperationsStatusClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OperationsStatusClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/operationsStatus/{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 OperationsStatusClient) 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 OperationsStatusClient) GetResponder(resp *http.Response) (result Job, 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/databoxedge/mgmt/2020-09-01-preview/databoxedge/orders.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/orders.go new file mode 100644 index 000000000000..5b1dfa34b4ba --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/orders.go @@ -0,0 +1,518 @@ +package databoxedge + +// 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" +) + +// OrdersClient is the client for the Orders methods of the Databoxedge service. +type OrdersClient struct { + BaseClient +} + +// NewOrdersClient creates an instance of the OrdersClient client. +func NewOrdersClient(subscriptionID string) OrdersClient { + return NewOrdersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewOrdersClientWithBaseURI creates an instance of the OrdersClient 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 NewOrdersClientWithBaseURI(baseURI string, subscriptionID string) OrdersClient { + return OrdersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// deviceName - the order details of a device. +// order - the order to be created or updated. +// resourceGroupName - the resource group name. +func (client OrdersClient) CreateOrUpdate(ctx context.Context, deviceName string, order Order, resourceGroupName string) (result OrdersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrdersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: order, + Constraints: []validation.Constraint{{Target: "order.OrderProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "order.OrderProperties.ContactInformation", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "order.OrderProperties.ContactInformation.ContactPerson", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "order.OrderProperties.ContactInformation.CompanyName", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "order.OrderProperties.ContactInformation.Phone", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "order.OrderProperties.ContactInformation.EmailList", Name: validation.Null, Rule: true, Chain: nil}, + }}, + {Target: "order.OrderProperties.ShippingAddress", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "order.OrderProperties.ShippingAddress.Country", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("databoxedge.OrdersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, order, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client OrdersClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, order Order, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default", pathParameters), + autorest.WithJSON(order), + 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 OrdersClient) CreateOrUpdateSender(req *http.Request) (future OrdersCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client OrdersClient) (o Order, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.OrdersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent { + o, err = client.CreateOrUpdateResponder(o.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersCreateOrUpdateFuture", "Result", o.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client OrdersClient) CreateOrUpdateResponder(resp *http.Response) (result Order, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete sends the delete request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client OrdersClient) Delete(ctx context.Context, deviceName string, resourceGroupName string) (result OrdersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrdersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client OrdersClient) DeletePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/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 OrdersClient) DeleteSender(req *http.Request) (future OrdersDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client OrdersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.OrdersDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client OrdersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client OrdersClient) Get(ctx context.Context, deviceName string, resourceGroupName string) (result Order, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrdersClient.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, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client OrdersClient) GetPreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/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 OrdersClient) 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 OrdersClient) GetResponder(resp *http.Response) (result Order, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice sends the list by data box edge device request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client OrdersClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result OrderListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrdersClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.ol.Response.Response != nil { + sc = result.ol.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.ol.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.ol, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.ol.hasNextLink() && result.ol.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client OrdersClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client OrdersClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client OrdersClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result OrderList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client OrdersClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults OrderList) (result OrderList, err error) { + req, err := lastResults.orderListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client OrdersClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result OrderListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrdersClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} + +// ListDCAccessCode sends the list dc access code request. +// Parameters: +// deviceName - the device name +// resourceGroupName - the resource group name. +func (client OrdersClient) ListDCAccessCode(ctx context.Context, deviceName string, resourceGroupName string) (result DCAccessCode, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OrdersClient.ListDCAccessCode") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListDCAccessCodePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "ListDCAccessCode", nil, "Failure preparing request") + return + } + + resp, err := client.ListDCAccessCodeSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "ListDCAccessCode", resp, "Failure sending request") + return + } + + result, err = client.ListDCAccessCodeResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.OrdersClient", "ListDCAccessCode", resp, "Failure responding to request") + return + } + + return +} + +// ListDCAccessCodePreparer prepares the ListDCAccessCode request. +func (client OrdersClient) ListDCAccessCodePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/orders/default/listDCAccessCode", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListDCAccessCodeSender sends the ListDCAccessCode request. The method will close the +// http.Response Body if it receives an error. +func (client OrdersClient) ListDCAccessCodeSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListDCAccessCodeResponder handles the response to the ListDCAccessCode request. The method always +// closes the http.Response Body. +func (client OrdersClient) ListDCAccessCodeResponder(resp *http.Response) (result DCAccessCode, 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/databoxedge/mgmt/2020-09-01-preview/databoxedge/roles.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/roles.go new file mode 100644 index 000000000000..1163fe03c470 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/roles.go @@ -0,0 +1,432 @@ +package databoxedge + +// 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" +) + +// RolesClient is the client for the Roles methods of the Databoxedge service. +type RolesClient struct { + BaseClient +} + +// NewRolesClient creates an instance of the RolesClient client. +func NewRolesClient(subscriptionID string) RolesClient { + return NewRolesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRolesClientWithBaseURI creates an instance of the RolesClient 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 NewRolesClientWithBaseURI(baseURI string, subscriptionID string) RolesClient { + return RolesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create or update a role. +// Parameters: +// deviceName - the device name. +// name - the role name. +// role - the role properties. +// resourceGroupName - the resource group name. +func (client RolesClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, role BasicRole, resourceGroupName string) (result RolesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RolesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, role, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client RolesClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, role BasicRole, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{name}", pathParameters), + autorest.WithJSON(role), + 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 RolesClient) CreateOrUpdateSender(req *http.Request) (future RolesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client RolesClient) (rm RoleModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.RolesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if rm.Response.Response, err = future.GetResult(sender); err == nil && rm.Response.Response.StatusCode != http.StatusNoContent { + rm, err = client.CreateOrUpdateResponder(rm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesCreateOrUpdateFuture", "Result", rm.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client RolesClient) CreateOrUpdateResponder(resp *http.Response) (result RoleModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the role on the device. +// Parameters: +// deviceName - the device name. +// name - the role name. +// resourceGroupName - the resource group name. +func (client RolesClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result RolesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RolesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client RolesClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{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 RolesClient) DeleteSender(req *http.Request) (future RolesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client RolesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.RolesDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client RolesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets a specific role by name. +// Parameters: +// deviceName - the device name. +// name - the role name. +// resourceGroupName - the resource group name. +func (client RolesClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result RoleModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RolesClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client RolesClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles/{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 RolesClient) 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 RolesClient) GetResponder(resp *http.Response) (result RoleModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice lists all the roles configured in a Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client RolesClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result RoleListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RolesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.rl.Response.Response != nil { + sc = result.rl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.rl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.rl, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.rl.hasNextLink() && result.rl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client RolesClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/roles", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client RolesClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client RolesClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result RoleList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client RolesClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults RoleList) (result RoleList, err error) { + req, err := lastResults.roleListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.RolesClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.RolesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.RolesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client RolesClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result RoleListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RolesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/shares.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/shares.go new file mode 100644 index 000000000000..3b22450292a5 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/shares.go @@ -0,0 +1,536 @@ +package databoxedge + +// 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" +) + +// SharesClient is the client for the Shares methods of the Databoxedge service. +type SharesClient struct { + BaseClient +} + +// NewSharesClient creates an instance of the SharesClient client. +func NewSharesClient(subscriptionID string) SharesClient { + return NewSharesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSharesClientWithBaseURI creates an instance of the SharesClient 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 NewSharesClientWithBaseURI(baseURI string, subscriptionID string) SharesClient { + return SharesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// deviceName - the device name. +// name - the share name. +// share - the share properties. +// resourceGroupName - the resource group name. +func (client SharesClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, share Share, resourceGroupName string) (result SharesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: share, + Constraints: []validation.Constraint{{Target: "share.ShareProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "share.ShareProperties.AzureContainerInfo", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "share.ShareProperties.AzureContainerInfo.StorageAccountCredentialID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "share.ShareProperties.AzureContainerInfo.ContainerName", Name: validation.Null, Rule: true, Chain: nil}, + }}, + }}}}}); err != nil { + return result, validation.NewError("databoxedge.SharesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, share, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client SharesClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, share Share, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}", pathParameters), + autorest.WithJSON(share), + 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 SharesClient) CreateOrUpdateSender(req *http.Request) (future SharesCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client SharesClient) (s Share, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.SharesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { + s, err = client.CreateOrUpdateResponder(s.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesCreateOrUpdateFuture", "Result", s.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client SharesClient) CreateOrUpdateResponder(resp *http.Response) (result Share, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the share on the Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// name - the share name. +// resourceGroupName - the resource group name. +func (client SharesClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result SharesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client SharesClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{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 SharesClient) DeleteSender(req *http.Request) (future SharesDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client SharesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.SharesDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client SharesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// name - the share name. +// resourceGroupName - the resource group name. +func (client SharesClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result Share, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client SharesClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{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 SharesClient) 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 SharesClient) GetResponder(resp *http.Response) (result Share, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice sends the list by data box edge device request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client SharesClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result ShareListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.sl.Response.Response != nil { + sc = result.sl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.sl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.sl, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.sl.hasNextLink() && result.sl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client SharesClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client SharesClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client SharesClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result ShareList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client SharesClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults ShareList) (result ShareList, err error) { + req, err := lastResults.shareListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.SharesClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.SharesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client SharesClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result ShareListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} + +// Refresh sends the refresh request. +// Parameters: +// deviceName - the device name. +// name - the share name. +// resourceGroupName - the resource group name. +func (client SharesClient) Refresh(ctx context.Context, deviceName string, name string, resourceGroupName string) (result SharesRefreshFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SharesClient.Refresh") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.RefreshPreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Refresh", nil, "Failure preparing request") + return + } + + result, err = client.RefreshSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesClient", "Refresh", nil, "Failure sending request") + return + } + + return +} + +// RefreshPreparer prepares the Refresh request. +func (client SharesClient) RefreshPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/shares/{name}/refresh", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// RefreshSender sends the Refresh request. The method will close the +// http.Response Body if it receives an error. +func (client SharesClient) RefreshSender(req *http.Request) (future SharesRefreshFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client SharesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.SharesRefreshFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.SharesRefreshFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// RefreshResponder handles the response to the Refresh request. The method always +// closes the http.Response Body. +func (client SharesClient) RefreshResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByClosing()) + result.Response = resp + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccountcredentials.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccountcredentials.go new file mode 100644 index 000000000000..13be226ef3dc --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccountcredentials.go @@ -0,0 +1,444 @@ +package databoxedge + +// 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" +) + +// StorageAccountCredentialsClient is the client for the StorageAccountCredentials methods of the Databoxedge service. +type StorageAccountCredentialsClient struct { + BaseClient +} + +// NewStorageAccountCredentialsClient creates an instance of the StorageAccountCredentialsClient client. +func NewStorageAccountCredentialsClient(subscriptionID string) StorageAccountCredentialsClient { + return NewStorageAccountCredentialsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStorageAccountCredentialsClientWithBaseURI creates an instance of the StorageAccountCredentialsClient 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 NewStorageAccountCredentialsClientWithBaseURI(baseURI string, subscriptionID string) StorageAccountCredentialsClient { + return StorageAccountCredentialsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates the storage account credential. +// Parameters: +// deviceName - the device name. +// name - the storage account credential name. +// storageAccountCredential - the storage account credential. +// resourceGroupName - the resource group name. +func (client StorageAccountCredentialsClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, storageAccountCredential StorageAccountCredential, resourceGroupName string) (result StorageAccountCredentialsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccountCredential, + Constraints: []validation.Constraint{{Target: "storageAccountCredential.StorageAccountCredentialProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "storageAccountCredential.StorageAccountCredentialProperties.Alias", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "storageAccountCredential.StorageAccountCredentialProperties.AccountKey", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "storageAccountCredential.StorageAccountCredentialProperties.AccountKey.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("databoxedge.StorageAccountCredentialsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, storageAccountCredential, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client StorageAccountCredentialsClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, storageAccountCredential StorageAccountCredential, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{name}", pathParameters), + autorest.WithJSON(storageAccountCredential), + 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 StorageAccountCredentialsClient) CreateOrUpdateSender(req *http.Request) (future StorageAccountCredentialsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client StorageAccountCredentialsClient) (sac StorageAccountCredential, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.StorageAccountCredentialsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sac.Response.Response, err = future.GetResult(sender); err == nil && sac.Response.Response.StatusCode != http.StatusNoContent { + sac, err = client.CreateOrUpdateResponder(sac.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsCreateOrUpdateFuture", "Result", sac.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client StorageAccountCredentialsClient) CreateOrUpdateResponder(resp *http.Response) (result StorageAccountCredential, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the storage account credential. +// Parameters: +// deviceName - the device name. +// name - the storage account credential name. +// resourceGroupName - the resource group name. +func (client StorageAccountCredentialsClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result StorageAccountCredentialsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client StorageAccountCredentialsClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{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 StorageAccountCredentialsClient) DeleteSender(req *http.Request) (future StorageAccountCredentialsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client StorageAccountCredentialsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.StorageAccountCredentialsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client StorageAccountCredentialsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified storage account credential. +// Parameters: +// deviceName - the device name. +// name - the storage account credential name. +// resourceGroupName - the resource group name. +func (client StorageAccountCredentialsClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result StorageAccountCredential, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialsClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client StorageAccountCredentialsClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials/{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 StorageAccountCredentialsClient) 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 StorageAccountCredentialsClient) GetResponder(resp *http.Response) (result StorageAccountCredential, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice sends the list by data box edge device request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client StorageAccountCredentialsClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result StorageAccountCredentialListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialsClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.sacl.Response.Response != nil { + sc = result.sacl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.sacl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.sacl, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.sacl.hasNextLink() && result.sacl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client StorageAccountCredentialsClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccountCredentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountCredentialsClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client StorageAccountCredentialsClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result StorageAccountCredentialList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client StorageAccountCredentialsClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults StorageAccountCredentialList) (result StorageAccountCredentialList, err error) { + req, err := lastResults.storageAccountCredentialListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountCredentialsClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client StorageAccountCredentialsClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result StorageAccountCredentialListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountCredentialsClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccounts.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccounts.go new file mode 100644 index 000000000000..2149d6d34e9c --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/storageaccounts.go @@ -0,0 +1,439 @@ +package databoxedge + +// 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" +) + +// StorageAccountsClient is the client for the StorageAccounts methods of the Databoxedge service. +type StorageAccountsClient struct { + BaseClient +} + +// NewStorageAccountsClient creates an instance of the StorageAccountsClient client. +func NewStorageAccountsClient(subscriptionID string) StorageAccountsClient { + return NewStorageAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewStorageAccountsClientWithBaseURI creates an instance of the StorageAccountsClient 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 NewStorageAccountsClientWithBaseURI(baseURI string, subscriptionID string) StorageAccountsClient { + return StorageAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate sends the create or update request. +// Parameters: +// deviceName - the device name. +// storageAccountName - the StorageAccount name. +// storageAccount - the StorageAccount properties. +// resourceGroupName - the resource group name. +func (client StorageAccountsClient) CreateOrUpdate(ctx context.Context, deviceName string, storageAccountName string, storageAccount StorageAccount, resourceGroupName string) (result StorageAccountsCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: storageAccount, + Constraints: []validation.Constraint{{Target: "storageAccount.StorageAccountProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { + return result, validation.NewError("databoxedge.StorageAccountsClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, storageAccountName, storageAccount, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client StorageAccountsClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, storageAccountName string, storageAccount StorageAccount, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}", pathParameters), + autorest.WithJSON(storageAccount), + 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 StorageAccountsClient) CreateOrUpdateSender(req *http.Request) (future StorageAccountsCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client StorageAccountsClient) (sa StorageAccount, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.StorageAccountsCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if sa.Response.Response, err = future.GetResult(sender); err == nil && sa.Response.Response.StatusCode != http.StatusNoContent { + sa, err = client.CreateOrUpdateResponder(sa.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsCreateOrUpdateFuture", "Result", sa.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) CreateOrUpdateResponder(resp *http.Response) (result StorageAccount, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the StorageAccount on the Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// storageAccountName - the StorageAccount name. +// resourceGroupName - the resource group name. +func (client StorageAccountsClient) Delete(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result StorageAccountsDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountsClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, storageAccountName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client StorageAccountsClient) DeletePreparer(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}", 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 StorageAccountsClient) DeleteSender(req *http.Request) (future StorageAccountsDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client StorageAccountsClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.StorageAccountsDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get sends the get request. +// Parameters: +// deviceName - the device name. +// storageAccountName - the storage account name. +// resourceGroupName - the resource group name. +func (client StorageAccountsClient) Get(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (result StorageAccount, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountsClient.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, deviceName, storageAccountName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client StorageAccountsClient) GetPreparer(ctx context.Context, deviceName string, storageAccountName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "storageAccountName": autorest.Encode("path", storageAccountName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts/{storageAccountName}", 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 StorageAccountsClient) 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 StorageAccountsClient) GetResponder(resp *http.Response) (result StorageAccount, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice sends the list by data box edge device request. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +func (client StorageAccountsClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string) (result StorageAccountListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountsClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.sal.Response.Response != nil { + sc = result.sal.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.sal.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.sal, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.sal.hasNextLink() && result.sal.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client StorageAccountsClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/storageAccounts", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client StorageAccountsClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client StorageAccountsClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result StorageAccountList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client StorageAccountsClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults StorageAccountList) (result StorageAccountList, err error) { + req, err := lastResults.storageAccountListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.StorageAccountsClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client StorageAccountsClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string) (result StorageAccountListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/StorageAccountsClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/triggers.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/triggers.go new file mode 100644 index 000000000000..17e9a91d897c --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/triggers.go @@ -0,0 +1,436 @@ +package databoxedge + +// 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" +) + +// TriggersClient is the client for the Triggers methods of the Databoxedge service. +type TriggersClient struct { + BaseClient +} + +// NewTriggersClient creates an instance of the TriggersClient client. +func NewTriggersClient(subscriptionID string) TriggersClient { + return NewTriggersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTriggersClientWithBaseURI creates an instance of the TriggersClient 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 NewTriggersClientWithBaseURI(baseURI string, subscriptionID string) TriggersClient { + return TriggersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates or updates a trigger. +// Parameters: +// deviceName - creates or updates a trigger +// name - the trigger name. +// trigger - the trigger. +// resourceGroupName - the resource group name. +func (client TriggersClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, trigger BasicTrigger, resourceGroupName string) (result TriggersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, trigger, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client TriggersClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, trigger BasicTrigger, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{name}", pathParameters), + autorest.WithJSON(trigger), + 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 TriggersClient) CreateOrUpdateSender(req *http.Request) (future TriggersCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client TriggersClient) (tm TriggerModel, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.TriggersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tm.Response.Response, err = future.GetResult(sender); err == nil && tm.Response.Response.StatusCode != http.StatusNoContent { + tm, err = client.CreateOrUpdateResponder(tm.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersCreateOrUpdateFuture", "Result", tm.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client TriggersClient) CreateOrUpdateResponder(resp *http.Response) (result TriggerModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the trigger on the gateway device. +// Parameters: +// deviceName - the device name. +// name - the trigger name. +// resourceGroupName - the resource group name. +func (client TriggersClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result TriggersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client TriggersClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{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 TriggersClient) DeleteSender(req *http.Request) (future TriggersDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client TriggersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.TriggersDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client TriggersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a specific trigger by name. +// Parameters: +// deviceName - the device name. +// name - the trigger name. +// resourceGroupName - the resource group name. +func (client TriggersClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result TriggerModel, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client TriggersClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers/{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 TriggersClient) 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 TriggersClient) GetResponder(resp *http.Response) (result TriggerModel, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice lists all the triggers configured in the device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +// filter - specify $filter='CustomContextTag eq ' to filter on custom context tag property +func (client TriggersClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string, filter string) (result TriggerListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.tl.Response.Response != nil { + sc = result.tl.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.tl.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.tl, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.tl.hasNextLink() && result.tl.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client TriggersClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/triggers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client TriggersClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client TriggersClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result TriggerList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client TriggersClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults TriggerList) (result TriggerList, err error) { + req, err := lastResults.triggerListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.TriggersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client TriggersClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string, filter string) (result TriggerListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TriggersClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName, filter) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/users.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/users.go new file mode 100644 index 000000000000..09a243291f4a --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/users.go @@ -0,0 +1,448 @@ +package databoxedge + +// 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" +) + +// UsersClient is the client for the Users methods of the Databoxedge service. +type UsersClient struct { + BaseClient +} + +// NewUsersClient creates an instance of the UsersClient client. +func NewUsersClient(subscriptionID string) UsersClient { + return NewUsersClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewUsersClientWithBaseURI creates an instance of the UsersClient 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 NewUsersClientWithBaseURI(baseURI string, subscriptionID string) UsersClient { + return UsersClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate creates a new user or updates an existing user's information on a Data Box Edge/Data Box Gateway +// device. +// Parameters: +// deviceName - the device name. +// name - the user name. +// userParameter - the user details. +// resourceGroupName - the resource group name. +func (client UsersClient) CreateOrUpdate(ctx context.Context, deviceName string, name string, userParameter User, resourceGroupName string) (result UsersCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: userParameter, + Constraints: []validation.Constraint{{Target: "userParameter.UserProperties", Name: validation.Null, Rule: true, + Chain: []validation.Constraint{{Target: "userParameter.UserProperties.EncryptedPassword", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "userParameter.UserProperties.EncryptedPassword.Value", Name: validation.Null, Rule: true, Chain: nil}}}, + }}}}}); err != nil { + return result, validation.NewError("databoxedge.UsersClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, deviceName, name, userParameter, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "CreateOrUpdate", nil, "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client UsersClient) CreateOrUpdatePreparer(ctx context.Context, deviceName string, name string, userParameter User, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{name}", pathParameters), + autorest.WithJSON(userParameter), + 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 UsersClient) CreateOrUpdateSender(req *http.Request) (future UsersCreateOrUpdateFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client UsersClient) (u User, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.UsersCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if u.Response.Response, err = future.GetResult(sender); err == nil && u.Response.Response.StatusCode != http.StatusNoContent { + u, err = client.CreateOrUpdateResponder(u.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersCreateOrUpdateFuture", "Result", u.Response.Response, "Failure responding to request") + } + } + return + } + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client UsersClient) CreateOrUpdateResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete deletes the user on a databox edge/gateway device. +// Parameters: +// deviceName - the device name. +// name - the user name. +// resourceGroupName - the resource group name. +func (client UsersClient) Delete(ctx context.Context, deviceName string, name string, resourceGroupName string) (result UsersDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeletePreparer(ctx, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "Delete", nil, "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client UsersClient) DeletePreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{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 UsersClient) DeleteSender(req *http.Request) (future UsersDeleteFuture, err error) { + var resp *http.Response + resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) + if err != nil { + return + } + var azf azure.Future + azf, err = azure.NewFutureFromResponse(resp) + future.FutureAPI = &azf + future.Result = func(client UsersClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("databoxedge.UsersDeleteFuture") + return + } + ar.Response = future.Response() + return + } + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client UsersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the properties of the specified user. +// Parameters: +// deviceName - the device name. +// name - the user name. +// resourceGroupName - the resource group name. +func (client UsersClient) Get(ctx context.Context, deviceName string, name string, resourceGroupName string) (result User, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.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, deviceName, name, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client UsersClient) GetPreparer(ctx context.Context, deviceName string, name string, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "name": autorest.Encode("path", name), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users/{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 UsersClient) 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 UsersClient) GetResponder(resp *http.Response) (result User, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByDataBoxEdgeDevice gets all the users registered on a Data Box Edge/Data Box Gateway device. +// Parameters: +// deviceName - the device name. +// resourceGroupName - the resource group name. +// expand - specify $expand=details to populate additional fields related to the resource or Specify +// $skipToken= to populate the next page in the list. +func (client UsersClient) ListByDataBoxEdgeDevice(ctx context.Context, deviceName string, resourceGroupName string, expand string) (result UserListPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.ul.Response.Response != nil { + sc = result.ul.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByDataBoxEdgeDeviceNextResults + req, err := client.ListByDataBoxEdgeDevicePreparer(ctx, deviceName, resourceGroupName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "ListByDataBoxEdgeDevice", nil, "Failure preparing request") + return + } + + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.ul.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "ListByDataBoxEdgeDevice", resp, "Failure sending request") + return + } + + result.ul, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "ListByDataBoxEdgeDevice", resp, "Failure responding to request") + return + } + if result.ul.hasNextLink() && result.ul.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByDataBoxEdgeDevicePreparer prepares the ListByDataBoxEdgeDevice request. +func (client UsersClient) ListByDataBoxEdgeDevicePreparer(ctx context.Context, deviceName string, resourceGroupName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "deviceName": autorest.Encode("path", deviceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2020-09-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/{deviceName}/users", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByDataBoxEdgeDeviceSender sends the ListByDataBoxEdgeDevice request. The method will close the +// http.Response Body if it receives an error. +func (client UsersClient) ListByDataBoxEdgeDeviceSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByDataBoxEdgeDeviceResponder handles the response to the ListByDataBoxEdgeDevice request. The method always +// closes the http.Response Body. +func (client UsersClient) ListByDataBoxEdgeDeviceResponder(resp *http.Response) (result UserList, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByDataBoxEdgeDeviceNextResults retrieves the next set of results, if any. +func (client UsersClient) listByDataBoxEdgeDeviceNextResults(ctx context.Context, lastResults UserList) (result UserList, err error) { + req, err := lastResults.userListPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "databoxedge.UsersClient", "listByDataBoxEdgeDeviceNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByDataBoxEdgeDeviceSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "databoxedge.UsersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByDataBoxEdgeDeviceResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "databoxedge.UsersClient", "listByDataBoxEdgeDeviceNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByDataBoxEdgeDeviceComplete enumerates all values, automatically crossing page boundaries as required. +func (client UsersClient) ListByDataBoxEdgeDeviceComplete(ctx context.Context, deviceName string, resourceGroupName string, expand string) (result UserListIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/UsersClient.ListByDataBoxEdgeDevice") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByDataBoxEdgeDevice(ctx, deviceName, resourceGroupName, expand) + return +} diff --git a/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/version.go b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/version.go new file mode 100644 index 000000000000..0eb2bd6b0148 --- /dev/null +++ b/services/preview/databoxedge/mgmt/2020-09-01-preview/databoxedge/version.go @@ -0,0 +1,30 @@ +package databoxedge + +import "github.com/Azure/azure-sdk-for-go/version" + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/" + Version() + " databoxedge/2020-09-01-preview" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return version.Number +}