vendor: add github.com/Azure/azure-sdk-for-go and dependencies
This commit is contained in:
Generated
Vendored
+385
@@ -0,0 +1,385 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// AccessControlRecordsClient is the client for the AccessControlRecords
|
||||
// methods of the Storsimple8000series service.
|
||||
type AccessControlRecordsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewAccessControlRecordsClient creates an instance of the
|
||||
// AccessControlRecordsClient client.
|
||||
func NewAccessControlRecordsClient(subscriptionID string) AccessControlRecordsClient {
|
||||
return NewAccessControlRecordsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewAccessControlRecordsClientWithBaseURI creates an instance of the
|
||||
// AccessControlRecordsClient client.
|
||||
func NewAccessControlRecordsClientWithBaseURI(baseURI string, subscriptionID string) AccessControlRecordsClient {
|
||||
return AccessControlRecordsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or Updates an access control record. This method may
|
||||
// poll for completion. Polling can be canceled by passing the cancel channel
|
||||
// argument. The channel will be used to cancel polling and any outstanding
|
||||
// HTTP requests.
|
||||
//
|
||||
// accessControlRecordName is the name of the access control record. parameters
|
||||
// is the access control record to be added or updated. resourceGroupName is
|
||||
// the resource group name managerName is the manager name
|
||||
func (client AccessControlRecordsClient) CreateOrUpdate(accessControlRecordName string, parameters AccessControlRecord, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan AccessControlRecord, <-chan error) {
|
||||
resultChan := make(chan AccessControlRecord, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AccessControlRecordProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.AccessControlRecordProperties.InitiatorName", Name: validation.Null, Rule: true, Chain: nil}}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result AccessControlRecord
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(accessControlRecordName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client AccessControlRecordsClient) CreateOrUpdatePreparer(accessControlRecordName string, parameters AccessControlRecord, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"accessControlRecordName": accessControlRecordName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AccessControlRecordsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AccessControlRecordsClient) CreateOrUpdateResponder(resp *http.Response) (result AccessControlRecord, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the access control record. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// accessControlRecordName is the name of the access control record to delete.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client AccessControlRecordsClient) Delete(accessControlRecordName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(accessControlRecordName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client AccessControlRecordsClient) DeletePreparer(accessControlRecordName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"accessControlRecordName": accessControlRecordName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AccessControlRecordsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AccessControlRecordsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get returns the properties of the specified access control record name.
|
||||
//
|
||||
// accessControlRecordName is name of access control record to be fetched.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client AccessControlRecordsClient) Get(accessControlRecordName string, resourceGroupName string, managerName string) (result AccessControlRecord, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(accessControlRecordName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client AccessControlRecordsClient) GetPreparer(accessControlRecordName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"accessControlRecordName": accessControlRecordName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords/{accessControlRecordName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AccessControlRecordsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AccessControlRecordsClient) GetResponder(resp *http.Response) (result AccessControlRecord, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManager retrieves all the access control records in a manager.
|
||||
//
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client AccessControlRecordsClient) ListByManager(resourceGroupName string, managerName string) (result AccessControlRecordList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager")
|
||||
}
|
||||
|
||||
req, err := client.ListByManagerPreparer(resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AccessControlRecordsClient", "ListByManager", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerPreparer prepares the ListByManager request.
|
||||
func (client AccessControlRecordsClient) ListByManagerPreparer(resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/accessControlRecords", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByManagerSender sends the ListByManager request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AccessControlRecordsClient) ListByManagerSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByManagerResponder handles the response to the ListByManager request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AccessControlRecordsClient) ListByManagerResponder(resp *http.Response) (result AccessControlRecordList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+341
@@ -0,0 +1,341 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// AlertsClient is the client for the Alerts methods of the
|
||||
// Storsimple8000series service.
|
||||
type AlertsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewAlertsClientWithBaseURI(baseURI string, subscriptionID string) AlertsClient {
|
||||
return AlertsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Clear clear the alerts.
|
||||
//
|
||||
// parameters is the clear alert request. resourceGroupName is the resource
|
||||
// group name managerName is the manager name
|
||||
func (client AlertsClient) Clear(parameters ClearAlertRequest, resourceGroupName string, managerName string) (result autorest.Response, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.Alerts", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AlertsClient", "Clear")
|
||||
}
|
||||
|
||||
req, err := client.ClearPreparer(parameters, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "Clear", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ClearSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "Clear", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ClearResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "Clear", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ClearPreparer prepares the Clear request.
|
||||
func (client AlertsClient) ClearPreparer(parameters ClearAlertRequest, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/clearAlerts", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ClearSender sends the Clear request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AlertsClient) ClearSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ClearResponder handles the response to the Clear request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AlertsClient) ClearResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManager retrieves all the alerts in a manager.
|
||||
//
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
// filter is oData Filter options
|
||||
func (client AlertsClient) ListByManager(resourceGroupName string, managerName string, filter string) (result AlertList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AlertsClient", "ListByManager")
|
||||
}
|
||||
|
||||
req, err := client.ListByManagerPreparer(resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerPreparer prepares the ListByManager request.
|
||||
func (client AlertsClient) ListByManagerPreparer(resourceGroupName string, managerName string, filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
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.StorSimple/managers/{managerName}/alerts", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByManagerSender sends the ListByManager request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AlertsClient) ListByManagerSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByManagerResponder handles the response to the ListByManager request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AlertsClient) ListByManagerResponder(resp *http.Response) (result AlertList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerNextResults retrieves the next set of results, if any.
|
||||
func (client AlertsClient) ListByManagerNextResults(lastResults AlertList) (result AlertList, err error) {
|
||||
req, err := lastResults.AlertListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "ListByManager", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerComplete gets all elements from the list without paging.
|
||||
func (client AlertsClient) ListByManagerComplete(resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Alert, <-chan error) {
|
||||
resultChan := make(chan Alert)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.ListByManager(resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.NextLink != nil {
|
||||
list, err = client.ListByManagerNextResults(list)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// SendTestEmail sends a test alert email.
|
||||
//
|
||||
// deviceName is the device name parameters is the send test alert email
|
||||
// request. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client AlertsClient) SendTestEmail(deviceName string, parameters SendTestAlertEmailRequest, resourceGroupName string, managerName string) (result autorest.Response, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.EmailList", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.AlertsClient", "SendTestEmail")
|
||||
}
|
||||
|
||||
req, err := client.SendTestEmailPreparer(deviceName, parameters, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "SendTestEmail", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.SendTestEmailSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "SendTestEmail", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.SendTestEmailResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.AlertsClient", "SendTestEmail", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// SendTestEmailPreparer prepares the SendTestEmail request.
|
||||
func (client AlertsClient) SendTestEmailPreparer(deviceName string, parameters SendTestAlertEmailRequest, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/sendTestAlertEmail", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// SendTestEmailSender sends the SendTestEmail request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client AlertsClient) SendTestEmailSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// SendTestEmailResponder handles the response to the SendTestEmail request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client AlertsClient) SendTestEmailResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+487
@@ -0,0 +1,487 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// BackupPoliciesClient is the client for the BackupPolicies methods of the
|
||||
// Storsimple8000series service.
|
||||
type BackupPoliciesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient
|
||||
// client.
|
||||
func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient {
|
||||
return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewBackupPoliciesClientWithBaseURI creates an instance of the
|
||||
// BackupPoliciesClient client.
|
||||
func NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient {
|
||||
return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// BackupNow backup the backup policy now. This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the backup policy name.
|
||||
// backupType is the backup Type. This can be cloudSnapshot or localSnapshot.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BackupPoliciesClient) BackupNow(deviceName string, backupPolicyName string, backupType string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.BackupNowPreparer(deviceName, backupPolicyName, backupType, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.BackupNowSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.BackupNowResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "BackupNow", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// BackupNowPreparer prepares the BackupNow request.
|
||||
func (client BackupPoliciesClient) BackupNowPreparer(deviceName string, backupPolicyName string, backupType string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
"backupType": backupType,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/backup", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// BackupNowSender sends the BackupNow request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupPoliciesClient) BackupNowSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// BackupNowResponder handles the response to the BackupNow request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupPoliciesClient) BackupNowResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates the backup policy. This method may poll
|
||||
// for completion. Polling can be canceled by passing the cancel channel
|
||||
// argument. The channel will be used to cancel polling and any outstanding
|
||||
// HTTP requests.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the name of the backup
|
||||
// policy to be created/updated. parameters is the backup policy.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BackupPoliciesClient) CreateOrUpdate(deviceName string, backupPolicyName string, parameters BackupPolicy, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan BackupPolicy, <-chan error) {
|
||||
resultChan := make(chan BackupPolicy, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.BackupPolicyProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.BackupPolicyProperties.VolumeIds", Name: validation.Null, Rule: true, Chain: nil}}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result BackupPolicy
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(deviceName, backupPolicyName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client BackupPoliciesClient) CreateOrUpdatePreparer(deviceName string, backupPolicyName string, parameters BackupPolicy, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupPoliciesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupPoliciesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupPolicy, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the backup policy. This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the name of the backup
|
||||
// policy. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client BackupPoliciesClient) Delete(deviceName string, backupPolicyName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(deviceName, backupPolicyName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client BackupPoliciesClient) DeletePreparer(deviceName string, backupPolicyName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupPoliciesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the properties of the specified backup policy name.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the name of backup policy
|
||||
// to be fetched. resourceGroupName is the resource group name managerName is
|
||||
// the manager name
|
||||
func (client BackupPoliciesClient) Get(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (result BackupPolicy, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(deviceName, backupPolicyName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client BackupPoliciesClient) GetPreparer(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupPoliciesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupPoliciesClient) GetResponder(resp *http.Response) (result BackupPolicy, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevice gets all the backup policies in a device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client BackupPoliciesClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result BackupPolicyList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice")
|
||||
}
|
||||
|
||||
req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupPoliciesClient", "ListByDevice", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevicePreparer prepares the ListByDevice request.
|
||||
func (client BackupPoliciesClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByDeviceSender sends the ListByDevice request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupPoliciesClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByDeviceResponder handles the response to the ListByDevice request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupPoliciesClient) ListByDeviceResponder(resp *http.Response) (result BackupPolicyList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+489
@@ -0,0 +1,489 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// BackupsClient is the client for the Backups methods of the
|
||||
// Storsimple8000series service.
|
||||
type BackupsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewBackupsClient creates an instance of the BackupsClient client.
|
||||
func NewBackupsClient(subscriptionID string) BackupsClient {
|
||||
return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewBackupsClientWithBaseURI creates an instance of the BackupsClient client.
|
||||
func NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient {
|
||||
return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Clone clones the backup element as a new volume. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// deviceName is the device name backupName is the backup name.
|
||||
// backupElementName is the backup element name. parameters is the clone
|
||||
// request object. resourceGroupName is the resource group name managerName is
|
||||
// the manager name
|
||||
func (client BackupsClient) Clone(deviceName string, backupName string, backupElementName string, parameters CloneRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.TargetDeviceID", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.TargetVolumeName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.TargetAccessControlRecordIds", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupElement", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.BackupElement.ElementID", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupElement.ElementName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupElement.ElementType", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupElement.SizeInBytes", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupElement.VolumeName", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupElement.VolumeContainerID", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "Clone")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.ClonePreparer(deviceName, backupName, backupElementName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Clone", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CloneSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Clone", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CloneResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Clone", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ClonePreparer prepares the Clone request.
|
||||
func (client BackupsClient) ClonePreparer(deviceName string, backupName string, backupElementName string, parameters CloneRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupElementName": backupElementName,
|
||||
"backupName": backupName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}/elements/{backupElementName}/clone", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CloneSender sends the Clone request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupsClient) CloneSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CloneResponder handles the response to the Clone request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupsClient) CloneResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the backup. This method may poll for completion. Polling can
|
||||
// be canceled by passing the cancel channel argument. The channel will be used
|
||||
// to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name backupName is the backup name.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BackupsClient) Delete(deviceName string, backupName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(deviceName, backupName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client BackupsClient) DeletePreparer(deviceName string, backupName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupName": backupName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevice retrieves all the backups in a device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name filter is oData Filter options
|
||||
func (client BackupsClient) ListByDevice(deviceName string, resourceGroupName string, managerName string, filter string) (result BackupList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "ListByDevice")
|
||||
}
|
||||
|
||||
req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevicePreparer prepares the ListByDevice request.
|
||||
func (client BackupsClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
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.StorSimple/managers/{managerName}/devices/{deviceName}/backups", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByDeviceSender sends the ListByDevice request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupsClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByDeviceResponder handles the response to the ListByDevice request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupsClient) ListByDeviceResponder(resp *http.Response) (result BackupList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDeviceNextResults retrieves the next set of results, if any.
|
||||
func (client BackupsClient) ListByDeviceNextResults(lastResults BackupList) (result BackupList, err error) {
|
||||
req, err := lastResults.BackupListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "ListByDevice", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDeviceComplete gets all elements from the list without paging.
|
||||
func (client BackupsClient) ListByDeviceComplete(deviceName string, resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Backup, <-chan error) {
|
||||
resultChan := make(chan Backup)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.ListByDevice(deviceName, resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.NextLink != nil {
|
||||
list, err = client.ListByDeviceNextResults(list)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// Restore restores the backup on the device. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// deviceName is the device name backupName is the backupSet name
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BackupsClient) Restore(deviceName string, backupName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupsClient", "Restore")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.RestorePreparer(deviceName, backupName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Restore", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.RestoreSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Restore", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.RestoreResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupsClient", "Restore", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// RestorePreparer prepares the Restore request.
|
||||
func (client BackupsClient) RestorePreparer(deviceName string, backupName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupName": backupName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backups/{backupName}/restore", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// RestoreSender sends the Restore request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupsClient) RestoreSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// RestoreResponder handles the response to the Restore request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupsClient) RestoreResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+400
@@ -0,0 +1,400 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// BackupSchedulesClient is the client for the BackupSchedules methods of the
|
||||
// Storsimple8000series service.
|
||||
type BackupSchedulesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewBackupSchedulesClient creates an instance of the BackupSchedulesClient
|
||||
// client.
|
||||
func NewBackupSchedulesClient(subscriptionID string) BackupSchedulesClient {
|
||||
return NewBackupSchedulesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewBackupSchedulesClientWithBaseURI creates an instance of the
|
||||
// BackupSchedulesClient client.
|
||||
func NewBackupSchedulesClientWithBaseURI(baseURI string, subscriptionID string) BackupSchedulesClient {
|
||||
return BackupSchedulesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates the backup schedule. This method may poll
|
||||
// for completion. Polling can be canceled by passing the cancel channel
|
||||
// argument. The channel will be used to cancel polling and any outstanding
|
||||
// HTTP requests.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the backup policy name.
|
||||
// backupScheduleName is the backup schedule name. parameters is the backup
|
||||
// schedule. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client BackupSchedulesClient) CreateOrUpdate(deviceName string, backupPolicyName string, backupScheduleName string, parameters BackupSchedule, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan BackupSchedule, <-chan error) {
|
||||
resultChan := make(chan BackupSchedule, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.BackupScheduleProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.BackupScheduleProperties.ScheduleRecurrence", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.BackupScheduleProperties.ScheduleRecurrence.RecurrenceValue", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{Target: "parameters.BackupScheduleProperties.RetentionCount", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.BackupScheduleProperties.StartTime", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result BackupSchedule
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(deviceName, backupPolicyName, backupScheduleName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client BackupSchedulesClient) CreateOrUpdatePreparer(deviceName string, backupPolicyName string, backupScheduleName string, parameters BackupSchedule, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"backupScheduleName": backupScheduleName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules/{backupScheduleName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupSchedulesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupSchedulesClient) CreateOrUpdateResponder(resp *http.Response) (result BackupSchedule, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the backup schedule. This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the backup policy name.
|
||||
// backupScheduleName is the name the backup schedule. resourceGroupName is the
|
||||
// resource group name managerName is the manager name
|
||||
func (client BackupSchedulesClient) Delete(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(deviceName, backupPolicyName, backupScheduleName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client BackupSchedulesClient) DeletePreparer(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"backupScheduleName": backupScheduleName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules/{backupScheduleName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupSchedulesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupSchedulesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the properties of the specified backup schedule name.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the backup policy name.
|
||||
// backupScheduleName is the name of the backup schedule to be fetched
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BackupSchedulesClient) Get(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string) (result BackupSchedule, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(deviceName, backupPolicyName, backupScheduleName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client BackupSchedulesClient) GetPreparer(deviceName string, backupPolicyName string, backupScheduleName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"backupScheduleName": backupScheduleName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules/{backupScheduleName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupSchedulesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupSchedulesClient) GetResponder(resp *http.Response) (result BackupSchedule, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByBackupPolicy gets all the backup schedules in a backup policy.
|
||||
//
|
||||
// deviceName is the device name backupPolicyName is the backup policy name.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BackupSchedulesClient) ListByBackupPolicy(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (result BackupScheduleList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy")
|
||||
}
|
||||
|
||||
req, err := client.ListByBackupPolicyPreparer(deviceName, backupPolicyName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByBackupPolicySender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByBackupPolicyResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BackupSchedulesClient", "ListByBackupPolicy", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByBackupPolicyPreparer prepares the ListByBackupPolicy request.
|
||||
func (client BackupSchedulesClient) ListByBackupPolicyPreparer(deviceName string, backupPolicyName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"backupPolicyName": backupPolicyName,
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/backupPolicies/{backupPolicyName}/schedules", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByBackupPolicySender sends the ListByBackupPolicy request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BackupSchedulesClient) ListByBackupPolicySender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByBackupPolicyResponder handles the response to the ListByBackupPolicy request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BackupSchedulesClient) ListByBackupPolicyResponder(resp *http.Response) (result BackupScheduleList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+384
@@ -0,0 +1,384 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// BandwidthSettingsClient is the client for the BandwidthSettings methods of
|
||||
// the Storsimple8000series service.
|
||||
type BandwidthSettingsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewBandwidthSettingsClient creates an instance of the
|
||||
// BandwidthSettingsClient client.
|
||||
func NewBandwidthSettingsClient(subscriptionID string) BandwidthSettingsClient {
|
||||
return NewBandwidthSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewBandwidthSettingsClientWithBaseURI creates an instance of the
|
||||
// BandwidthSettingsClient client.
|
||||
func NewBandwidthSettingsClientWithBaseURI(baseURI string, subscriptionID string) BandwidthSettingsClient {
|
||||
return BandwidthSettingsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates the bandwidth setting This method may poll
|
||||
// for completion. Polling can be canceled by passing the cancel channel
|
||||
// argument. The channel will be used to cancel polling and any outstanding
|
||||
// HTTP requests.
|
||||
//
|
||||
// bandwidthSettingName is the bandwidth setting name. parameters is the
|
||||
// bandwidth setting to be added or updated. resourceGroupName is the resource
|
||||
// group name managerName is the manager name
|
||||
func (client BandwidthSettingsClient) CreateOrUpdate(bandwidthSettingName string, parameters BandwidthSetting, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan BandwidthSetting, <-chan error) {
|
||||
resultChan := make(chan BandwidthSetting, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.BandwidthRateSettingProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.BandwidthRateSettingProperties.Schedules", Name: validation.Null, Rule: true, Chain: nil}}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result BandwidthSetting
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(bandwidthSettingName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client BandwidthSettingsClient) CreateOrUpdatePreparer(bandwidthSettingName string, parameters BandwidthSetting, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"bandwidthSettingName": bandwidthSettingName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/bandwidthSettings/{bandwidthSettingName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BandwidthSettingsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BandwidthSettingsClient) CreateOrUpdateResponder(resp *http.Response) (result BandwidthSetting, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the bandwidth setting This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// bandwidthSettingName is the name of the bandwidth setting. resourceGroupName
|
||||
// is the resource group name managerName is the manager name
|
||||
func (client BandwidthSettingsClient) Delete(bandwidthSettingName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(bandwidthSettingName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client BandwidthSettingsClient) DeletePreparer(bandwidthSettingName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"bandwidthSettingName": bandwidthSettingName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/bandwidthSettings/{bandwidthSettingName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BandwidthSettingsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BandwidthSettingsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get returns the properties of the specified bandwidth setting name.
|
||||
//
|
||||
// bandwidthSettingName is the name of bandwidth setting to be fetched.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BandwidthSettingsClient) Get(bandwidthSettingName string, resourceGroupName string, managerName string) (result BandwidthSetting, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(bandwidthSettingName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client BandwidthSettingsClient) GetPreparer(bandwidthSettingName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"bandwidthSettingName": bandwidthSettingName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/bandwidthSettings/{bandwidthSettingName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BandwidthSettingsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BandwidthSettingsClient) GetResponder(resp *http.Response) (result BandwidthSetting, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManager retrieves all the bandwidth setting in a manager.
|
||||
//
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client BandwidthSettingsClient) ListByManager(resourceGroupName string, managerName string) (result BandwidthSettingList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager")
|
||||
}
|
||||
|
||||
req, err := client.ListByManagerPreparer(resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.BandwidthSettingsClient", "ListByManager", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerPreparer prepares the ListByManager request.
|
||||
func (client BandwidthSettingsClient) ListByManagerPreparer(resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/bandwidthSettings", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByManagerSender sends the ListByManager request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client BandwidthSettingsClient) ListByManagerSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByManagerResponder handles the response to the ListByManager request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client BandwidthSettingsClient) ListByManagerResponder(resp *http.Response) (result BandwidthSettingList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
// Package storsimple8000series implements the Azure ARM Storsimple8000series
|
||||
// service API version 2017-06-01.
|
||||
//
|
||||
//
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// 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 Storsimple8000series
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Storsimple8000series.
|
||||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the ManagementClient client.
|
||||
func New(subscriptionID string) ManagementClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the ManagementClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
||||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
Generated
Vendored
+214
@@ -0,0 +1,214 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// CloudAppliancesClient is the client for the CloudAppliances methods of the
|
||||
// Storsimple8000series service.
|
||||
type CloudAppliancesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewCloudAppliancesClient creates an instance of the CloudAppliancesClient
|
||||
// client.
|
||||
func NewCloudAppliancesClient(subscriptionID string) CloudAppliancesClient {
|
||||
return NewCloudAppliancesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewCloudAppliancesClientWithBaseURI creates an instance of the
|
||||
// CloudAppliancesClient client.
|
||||
func NewCloudAppliancesClientWithBaseURI(baseURI string, subscriptionID string) CloudAppliancesClient {
|
||||
return CloudAppliancesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// ListSupportedConfigurations lists supported cloud appliance models and
|
||||
// supported configurations.
|
||||
//
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client CloudAppliancesClient) ListSupportedConfigurations(resourceGroupName string, managerName string) (result CloudApplianceConfigurationList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations")
|
||||
}
|
||||
|
||||
req, err := client.ListSupportedConfigurationsPreparer(resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSupportedConfigurationsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListSupportedConfigurationsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "ListSupportedConfigurations", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListSupportedConfigurationsPreparer prepares the ListSupportedConfigurations request.
|
||||
func (client CloudAppliancesClient) ListSupportedConfigurationsPreparer(resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/cloudApplianceConfigurations", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListSupportedConfigurationsSender sends the ListSupportedConfigurations request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client CloudAppliancesClient) ListSupportedConfigurationsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListSupportedConfigurationsResponder handles the response to the ListSupportedConfigurations request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client CloudAppliancesClient) ListSupportedConfigurationsResponder(resp *http.Response) (result CloudApplianceConfigurationList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Provision provisions cloud appliance. This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// parameters is the cloud appliance resourceGroupName is the resource group
|
||||
// name managerName is the manager name
|
||||
func (client CloudAppliancesClient) Provision(parameters CloudAppliance, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.Name", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.VnetRegion", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.CloudAppliancesClient", "Provision")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.ProvisionPreparer(parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "Provision", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ProvisionSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "Provision", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ProvisionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.CloudAppliancesClient", "Provision", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ProvisionPreparer prepares the Provision request.
|
||||
func (client CloudAppliancesClient) ProvisionPreparer(parameters CloudAppliance, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/provisionCloudAppliance", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ProvisionSender sends the Provision request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client CloudAppliancesClient) ProvisionSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ProvisionResponder handles the response to the Provision request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client CloudAppliancesClient) ProvisionResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
+1304
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+832
@@ -0,0 +1,832 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// DeviceSettingsClient is the client for the DeviceSettings methods of the
|
||||
// Storsimple8000series service.
|
||||
type DeviceSettingsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewDeviceSettingsClient creates an instance of the DeviceSettingsClient
|
||||
// client.
|
||||
func NewDeviceSettingsClient(subscriptionID string) DeviceSettingsClient {
|
||||
return NewDeviceSettingsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewDeviceSettingsClientWithBaseURI creates an instance of the
|
||||
// DeviceSettingsClient client.
|
||||
func NewDeviceSettingsClientWithBaseURI(baseURI string, subscriptionID string) DeviceSettingsClient {
|
||||
return DeviceSettingsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdateAlertSettings creates or updates the alert settings of the
|
||||
// specified device. This method may poll for completion. Polling can be
|
||||
// canceled by passing the cancel channel argument. The channel will be used to
|
||||
// cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name parameters is the alert settings to be added
|
||||
// or updated. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client DeviceSettingsClient) CreateOrUpdateAlertSettings(deviceName string, parameters AlertSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan AlertSettings, <-chan error) {
|
||||
resultChan := make(chan AlertSettings, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.AlertNotificationProperties", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result AlertSettings
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdateAlertSettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateAlertSettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateAlertSettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateAlertSettings", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdateAlertSettingsPreparer prepares the CreateOrUpdateAlertSettings request.
|
||||
func (client DeviceSettingsClient) CreateOrUpdateAlertSettingsPreparer(deviceName string, parameters AlertSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateAlertSettingsSender sends the CreateOrUpdateAlertSettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) CreateOrUpdateAlertSettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateAlertSettingsResponder handles the response to the CreateOrUpdateAlertSettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) CreateOrUpdateAlertSettingsResponder(resp *http.Response) (result AlertSettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// CreateOrUpdateTimeSettings creates or updates the time settings of the
|
||||
// specified device. This method may poll for completion. Polling can be
|
||||
// canceled by passing the cancel channel argument. The channel will be used to
|
||||
// cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name parameters is the time settings to be added or
|
||||
// updated. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client DeviceSettingsClient) CreateOrUpdateTimeSettings(deviceName string, parameters TimeSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan TimeSettings, <-chan error) {
|
||||
resultChan := make(chan TimeSettings, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.TimeSettingsProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.TimeSettingsProperties.TimeZone", Name: validation.Null, Rule: true, Chain: nil}}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result TimeSettings
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdateTimeSettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateTimeSettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateTimeSettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "CreateOrUpdateTimeSettings", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdateTimeSettingsPreparer prepares the CreateOrUpdateTimeSettings request.
|
||||
func (client DeviceSettingsClient) CreateOrUpdateTimeSettingsPreparer(deviceName string, parameters TimeSettings, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateTimeSettingsSender sends the CreateOrUpdateTimeSettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) CreateOrUpdateTimeSettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateTimeSettingsResponder handles the response to the CreateOrUpdateTimeSettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) CreateOrUpdateTimeSettingsResponder(resp *http.Response) (result TimeSettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetAlertSettings gets the alert settings of the specified device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client DeviceSettingsClient) GetAlertSettings(deviceName string, resourceGroupName string, managerName string) (result AlertSettings, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings")
|
||||
}
|
||||
|
||||
req, err := client.GetAlertSettingsPreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetAlertSettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetAlertSettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetAlertSettings", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetAlertSettingsPreparer prepares the GetAlertSettings request.
|
||||
func (client DeviceSettingsClient) GetAlertSettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/alertSettings/default", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetAlertSettingsSender sends the GetAlertSettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) GetAlertSettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetAlertSettingsResponder handles the response to the GetAlertSettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) GetAlertSettingsResponder(resp *http.Response) (result AlertSettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetNetworkSettings gets the network settings of the specified device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client DeviceSettingsClient) GetNetworkSettings(deviceName string, resourceGroupName string, managerName string) (result NetworkSettings, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings")
|
||||
}
|
||||
|
||||
req, err := client.GetNetworkSettingsPreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetNetworkSettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetNetworkSettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetNetworkSettings", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetNetworkSettingsPreparer prepares the GetNetworkSettings request.
|
||||
func (client DeviceSettingsClient) GetNetworkSettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetNetworkSettingsSender sends the GetNetworkSettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) GetNetworkSettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetNetworkSettingsResponder handles the response to the GetNetworkSettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) GetNetworkSettingsResponder(resp *http.Response) (result NetworkSettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetSecuritySettings returns the Security properties of the specified device
|
||||
// name.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client DeviceSettingsClient) GetSecuritySettings(deviceName string, resourceGroupName string, managerName string) (result SecuritySettings, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings")
|
||||
}
|
||||
|
||||
req, err := client.GetSecuritySettingsPreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSecuritySettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetSecuritySettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetSecuritySettings", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetSecuritySettingsPreparer prepares the GetSecuritySettings request.
|
||||
func (client DeviceSettingsClient) GetSecuritySettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSecuritySettingsSender sends the GetSecuritySettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) GetSecuritySettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetSecuritySettingsResponder handles the response to the GetSecuritySettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) GetSecuritySettingsResponder(resp *http.Response) (result SecuritySettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetTimeSettings gets the time settings of the specified device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client DeviceSettingsClient) GetTimeSettings(deviceName string, resourceGroupName string, managerName string) (result TimeSettings, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings")
|
||||
}
|
||||
|
||||
req, err := client.GetTimeSettingsPreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetTimeSettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetTimeSettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "GetTimeSettings", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetTimeSettingsPreparer prepares the GetTimeSettings request.
|
||||
func (client DeviceSettingsClient) GetTimeSettingsPreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/timeSettings/default", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetTimeSettingsSender sends the GetTimeSettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) GetTimeSettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetTimeSettingsResponder handles the response to the GetTimeSettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) GetTimeSettingsResponder(resp *http.Response) (result TimeSettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// SyncRemotemanagementCertificate sync Remote management Certificate between
|
||||
// appliance and Service This method may poll for completion. Polling can be
|
||||
// canceled by passing the cancel channel argument. The channel will be used to
|
||||
// cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client DeviceSettingsClient) SyncRemotemanagementCertificate(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.SyncRemotemanagementCertificatePreparer(deviceName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.SyncRemotemanagementCertificateSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.SyncRemotemanagementCertificateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "SyncRemotemanagementCertificate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// SyncRemotemanagementCertificatePreparer prepares the SyncRemotemanagementCertificate request.
|
||||
func (client DeviceSettingsClient) SyncRemotemanagementCertificatePreparer(deviceName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default/syncRemoteManagementCertificate", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// SyncRemotemanagementCertificateSender sends the SyncRemotemanagementCertificate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) SyncRemotemanagementCertificateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// SyncRemotemanagementCertificateResponder handles the response to the SyncRemotemanagementCertificate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) SyncRemotemanagementCertificateResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateNetworkSettings updates the network settings on the specified device.
|
||||
// This method may poll for completion. Polling can be canceled by passing the
|
||||
// cancel channel argument. The channel will be used to cancel polling and any
|
||||
// outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name parameters is the network settings to be
|
||||
// updated. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client DeviceSettingsClient) UpdateNetworkSettings(deviceName string, parameters NetworkSettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan NetworkSettings, <-chan error) {
|
||||
resultChan := make(chan NetworkSettings, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result NetworkSettings
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.UpdateNetworkSettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateNetworkSettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateNetworkSettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateNetworkSettings", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// UpdateNetworkSettingsPreparer prepares the UpdateNetworkSettings request.
|
||||
func (client DeviceSettingsClient) UpdateNetworkSettingsPreparer(deviceName string, parameters NetworkSettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/networkSettings/default", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// UpdateNetworkSettingsSender sends the UpdateNetworkSettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) UpdateNetworkSettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// UpdateNetworkSettingsResponder handles the response to the UpdateNetworkSettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) UpdateNetworkSettingsResponder(resp *http.Response) (result NetworkSettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// UpdateSecuritySettings patch Security properties of the specified device
|
||||
// name. This method may poll for completion. Polling can be canceled by
|
||||
// passing the cancel channel argument. The channel will be used to cancel
|
||||
// polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name parameters is the security settings properties
|
||||
// to be patched. resourceGroupName is the resource group name managerName is
|
||||
// the manager name
|
||||
func (client DeviceSettingsClient) UpdateSecuritySettings(deviceName string, parameters SecuritySettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan SecuritySettings, <-chan error) {
|
||||
resultChan := make(chan SecuritySettings, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result SecuritySettings
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.UpdateSecuritySettingsPreparer(deviceName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSecuritySettingsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateSecuritySettingsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.DeviceSettingsClient", "UpdateSecuritySettings", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// UpdateSecuritySettingsPreparer prepares the UpdateSecuritySettings request.
|
||||
func (client DeviceSettingsClient) UpdateSecuritySettingsPreparer(deviceName string, parameters SecuritySettingsPatch, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPatch(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/securitySettings/default", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// UpdateSecuritySettingsSender sends the UpdateSecuritySettings request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client DeviceSettingsClient) UpdateSecuritySettingsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// UpdateSecuritySettingsResponder handles the response to the UpdateSecuritySettings request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client DeviceSettingsClient) UpdateSecuritySettingsResponder(resp *http.Response) (result SecuritySettings, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
Generated
Vendored
+219
@@ -0,0 +1,219 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// HardwareComponentGroupsClient is the client for the HardwareComponentGroups
|
||||
// methods of the Storsimple8000series service.
|
||||
type HardwareComponentGroupsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewHardwareComponentGroupsClient creates an instance of the
|
||||
// HardwareComponentGroupsClient client.
|
||||
func NewHardwareComponentGroupsClient(subscriptionID string) HardwareComponentGroupsClient {
|
||||
return NewHardwareComponentGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewHardwareComponentGroupsClientWithBaseURI creates an instance of the
|
||||
// HardwareComponentGroupsClient client.
|
||||
func NewHardwareComponentGroupsClientWithBaseURI(baseURI string, subscriptionID string) HardwareComponentGroupsClient {
|
||||
return HardwareComponentGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// ChangeControllerPowerState changes the power state of the controller. This
|
||||
// method may poll for completion. Polling can be canceled by passing the
|
||||
// cancel channel argument. The channel will be used to cancel polling and any
|
||||
// outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name hardwareComponentGroupName is the hardware
|
||||
// component group name. parameters is the controller power state change
|
||||
// request. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client HardwareComponentGroupsClient) ChangeControllerPowerState(deviceName string, hardwareComponentGroupName string, parameters ControllerPowerStateChangeRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.ControllerPowerStateChangeRequestProperties", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.ChangeControllerPowerStatePreparer(deviceName, hardwareComponentGroupName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ChangeControllerPowerStateSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ChangeControllerPowerStateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ChangeControllerPowerState", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ChangeControllerPowerStatePreparer prepares the ChangeControllerPowerState request.
|
||||
func (client HardwareComponentGroupsClient) ChangeControllerPowerStatePreparer(deviceName string, hardwareComponentGroupName string, parameters ControllerPowerStateChangeRequest, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"hardwareComponentGroupName": hardwareComponentGroupName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/hardwareComponentGroups/{hardwareComponentGroupName}/changeControllerPowerState", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// ChangeControllerPowerStateSender sends the ChangeControllerPowerState request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client HardwareComponentGroupsClient) ChangeControllerPowerStateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// ChangeControllerPowerStateResponder handles the response to the ChangeControllerPowerState request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client HardwareComponentGroupsClient) ChangeControllerPowerStateResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevice lists the hardware component groups at device-level.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client HardwareComponentGroupsClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result HardwareComponentGroupList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice")
|
||||
}
|
||||
|
||||
req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.HardwareComponentGroupsClient", "ListByDevice", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevicePreparer prepares the ListByDevice request.
|
||||
func (client HardwareComponentGroupsClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/hardwareComponentGroups", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByDeviceSender sends the ListByDevice request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client HardwareComponentGroupsClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByDeviceResponder handles the response to the ListByDevice request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client HardwareComponentGroupsClient) ListByDeviceResponder(resp *http.Response) (result HardwareComponentGroupList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+504
@@ -0,0 +1,504 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// JobsClient is the client for the Jobs methods of the Storsimple8000series
|
||||
// service.
|
||||
type JobsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewJobsClientWithBaseURI(baseURI string, subscriptionID string) JobsClient {
|
||||
return JobsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Cancel cancels a job on the device. This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name jobName is the jobName. resourceGroupName is
|
||||
// the resource group name managerName is the manager name
|
||||
func (client JobsClient) Cancel(deviceName string, jobName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "Cancel")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CancelPreparer(deviceName, jobName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Cancel", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CancelSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Cancel", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CancelResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Cancel", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CancelPreparer prepares the Cancel request.
|
||||
func (client JobsClient) CancelPreparer(deviceName string, jobName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"jobName": jobName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/jobs/{jobName}/cancel", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CancelSender sends the Cancel request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client JobsClient) CancelSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CancelResponder handles the response to the Cancel request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client JobsClient) CancelResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the details of the specified job name.
|
||||
//
|
||||
// deviceName is the device name jobName is the job Name. resourceGroupName is
|
||||
// the resource group name managerName is the manager name
|
||||
func (client JobsClient) Get(deviceName string, jobName string, resourceGroupName string, managerName string) (result Job, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(deviceName, jobName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.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, "storsimple8000series.JobsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client JobsClient) GetPreparer(deviceName string, jobName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"jobName": jobName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/jobs/{jobName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// 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 autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevice gets all the jobs for specified device. With optional OData
|
||||
// query parameters, a filtered set of jobs is returned.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name filter is oData Filter options
|
||||
func (client JobsClient) ListByDevice(deviceName string, resourceGroupName string, managerName string, filter string) (result JobList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "ListByDevice")
|
||||
}
|
||||
|
||||
req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevicePreparer prepares the ListByDevice request.
|
||||
func (client JobsClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
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.StorSimple/managers/{managerName}/devices/{deviceName}/jobs", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByDeviceSender sends the ListByDevice request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client JobsClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByDeviceResponder handles the response to the ListByDevice request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client JobsClient) ListByDeviceResponder(resp *http.Response) (result JobList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDeviceNextResults retrieves the next set of results, if any.
|
||||
func (client JobsClient) ListByDeviceNextResults(lastResults JobList) (result JobList, err error) {
|
||||
req, err := lastResults.JobListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByDevice", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDeviceComplete gets all elements from the list without paging.
|
||||
func (client JobsClient) ListByDeviceComplete(deviceName string, resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Job, <-chan error) {
|
||||
resultChan := make(chan Job)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.ListByDevice(deviceName, resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.NextLink != nil {
|
||||
list, err = client.ListByDeviceNextResults(list)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// ListByManager gets all the jobs for the specified manager. With optional
|
||||
// OData query parameters, a filtered set of jobs is returned.
|
||||
//
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
// filter is oData Filter options
|
||||
func (client JobsClient) ListByManager(resourceGroupName string, managerName string, filter string) (result JobList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.JobsClient", "ListByManager")
|
||||
}
|
||||
|
||||
req, err := client.ListByManagerPreparer(resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerPreparer prepares the ListByManager request.
|
||||
func (client JobsClient) ListByManagerPreparer(resourceGroupName string, managerName string, filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
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.StorSimple/managers/{managerName}/jobs", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByManagerSender sends the ListByManager request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client JobsClient) ListByManagerSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByManagerResponder handles the response to the ListByManager request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client JobsClient) ListByManagerResponder(resp *http.Response) (result JobList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerNextResults retrieves the next set of results, if any.
|
||||
func (client JobsClient) ListByManagerNextResults(lastResults JobList) (result JobList, err error) {
|
||||
req, err := lastResults.JobListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.JobsClient", "ListByManager", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerComplete gets all elements from the list without paging.
|
||||
func (client JobsClient) ListByManagerComplete(resourceGroupName string, managerName string, filter string, cancel <-chan struct{}) (<-chan Job, <-chan error) {
|
||||
resultChan := make(chan Job)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.ListByManager(resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.NextLink != nil {
|
||||
list, err = client.ListByManagerNextResults(list)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
+1354
File diff suppressed because it is too large
Load Diff
+1954
File diff suppressed because it is too large
Load Diff
+169
@@ -0,0 +1,169 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// OperationsClient is the client for the Operations methods of the
|
||||
// Storsimple8000series service.
|
||||
type OperationsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
|
||||
return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// List lists all of the available REST API operations of the
|
||||
// Microsoft.Storsimple provider
|
||||
func (client OperationsClient) List() (result AvailableProviderOperationList, err error) {
|
||||
req, err := client.ListPreparer()
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPreparer prepares the List request.
|
||||
func (client OperationsClient) ListPreparer() (*http.Request, error) {
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPath("/providers/Microsoft.StorSimple/operations"),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// 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 autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListResponder handles the response to the List request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client OperationsClient) ListResponder(resp *http.Response) (result AvailableProviderOperationList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
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(lastResults AvailableProviderOperationList) (result AvailableProviderOperationList, err error) {
|
||||
req, err := lastResults.AvailableProviderOperationListPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", 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, "storsimple8000series.OperationsClient", "List", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.OperationsClient", "List", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListComplete gets all elements from the list without paging.
|
||||
func (client OperationsClient) ListComplete(cancel <-chan struct{}) (<-chan AvailableProviderOperation, <-chan error) {
|
||||
resultChan := make(chan AvailableProviderOperation)
|
||||
errChan := make(chan error, 1)
|
||||
go func() {
|
||||
defer func() {
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
list, err := client.List()
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
for list.NextLink != nil {
|
||||
list, err = client.ListNextResults(list)
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
return
|
||||
}
|
||||
if list.Value != nil {
|
||||
for _, item := range *list.Value {
|
||||
select {
|
||||
case <-cancel:
|
||||
return
|
||||
case resultChan <- item:
|
||||
// Intentionally left blank
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
Generated
Vendored
+389
@@ -0,0 +1,389 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// StorageAccountCredentialsClient is the client for the
|
||||
// StorageAccountCredentials methods of the Storsimple8000series service.
|
||||
type StorageAccountCredentialsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// 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.
|
||||
func NewStorageAccountCredentialsClientWithBaseURI(baseURI string, subscriptionID string) StorageAccountCredentialsClient {
|
||||
return StorageAccountCredentialsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates the storage account credential. This
|
||||
// method may poll for completion. Polling can be canceled by passing the
|
||||
// cancel channel argument. The channel will be used to cancel polling and any
|
||||
// outstanding HTTP requests.
|
||||
//
|
||||
// storageAccountCredentialName is the storage account credential name.
|
||||
// parameters is the storage account credential to be added or updated.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client StorageAccountCredentialsClient) CreateOrUpdate(storageAccountCredentialName string, parameters StorageAccountCredential, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan StorageAccountCredential, <-chan error) {
|
||||
resultChan := make(chan StorageAccountCredential, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.StorageAccountCredentialProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.StorageAccountCredentialProperties.EndPoint", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.StorageAccountCredentialProperties.AccessKey", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "parameters.StorageAccountCredentialProperties.AccessKey.Value", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result StorageAccountCredential
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(storageAccountCredentialName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client StorageAccountCredentialsClient) CreateOrUpdatePreparer(storageAccountCredentialName string, parameters StorageAccountCredential, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"storageAccountCredentialName": storageAccountCredentialName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{storageAccountCredentialName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// 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) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the storage account credential. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// storageAccountCredentialName is the name of the storage account credential.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client StorageAccountCredentialsClient) Delete(storageAccountCredentialName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(storageAccountCredentialName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client StorageAccountCredentialsClient) DeletePreparer(storageAccountCredentialName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"storageAccountCredentialName": storageAccountCredentialName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{storageAccountCredentialName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// 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) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the properties of the specified storage account credential name.
|
||||
//
|
||||
// storageAccountCredentialName is the name of storage account credential to be
|
||||
// fetched. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client StorageAccountCredentialsClient) Get(storageAccountCredentialName string, resourceGroupName string, managerName string) (result StorageAccountCredential, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(storageAccountCredentialName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.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, "storsimple8000series.StorageAccountCredentialsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client StorageAccountCredentialsClient) GetPreparer(storageAccountCredentialName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"storageAccountCredentialName": storageAccountCredentialName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials/{storageAccountCredentialName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// 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 autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// 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,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManager gets all the storage account credentials in a manager.
|
||||
//
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client StorageAccountCredentialsClient) ListByManager(resourceGroupName string, managerName string) (result StorageAccountCredentialList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager")
|
||||
}
|
||||
|
||||
req, err := client.ListByManagerPreparer(resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByManagerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByManagerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.StorageAccountCredentialsClient", "ListByManager", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByManagerPreparer prepares the ListByManager request.
|
||||
func (client StorageAccountCredentialsClient) ListByManagerPreparer(resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/storageAccountCredentials", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByManagerSender sends the ListByManager request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client StorageAccountCredentialsClient) ListByManagerSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByManagerResponder handles the response to the ListByManager request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client StorageAccountCredentialsClient) ListByManagerResponder(resp *http.Response) (result StorageAccountCredentialList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// 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/v10.1.0-beta arm-storsimple8000series/2017-06-01"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v10.1.0-beta"
|
||||
}
|
||||
Generated
Vendored
+548
@@ -0,0 +1,548 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// VolumeContainersClient is the client for the VolumeContainers methods of the
|
||||
// Storsimple8000series service.
|
||||
type VolumeContainersClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewVolumeContainersClient creates an instance of the VolumeContainersClient
|
||||
// client.
|
||||
func NewVolumeContainersClient(subscriptionID string) VolumeContainersClient {
|
||||
return NewVolumeContainersClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewVolumeContainersClientWithBaseURI creates an instance of the
|
||||
// VolumeContainersClient client.
|
||||
func NewVolumeContainersClientWithBaseURI(baseURI string, subscriptionID string) VolumeContainersClient {
|
||||
return VolumeContainersClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates the volume container. This method may poll
|
||||
// for completion. Polling can be canceled by passing the cancel channel
|
||||
// argument. The channel will be used to cancel polling and any outstanding
|
||||
// HTTP requests.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the name of the volume
|
||||
// container. parameters is the volume container to be added or updated.
|
||||
// resourceGroupName is the resource group name managerName is the manager name
|
||||
func (client VolumeContainersClient) CreateOrUpdate(deviceName string, volumeContainerName string, parameters VolumeContainer, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan VolumeContainer, <-chan error) {
|
||||
resultChan := make(chan VolumeContainer, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.VolumeContainerProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.VolumeContainerProperties.EncryptionKey", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "parameters.VolumeContainerProperties.EncryptionKey.Value", Name: validation.Null, Rule: true, Chain: nil}}},
|
||||
{Target: "parameters.VolumeContainerProperties.StorageAccountCredentialID", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result VolumeContainer
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(deviceName, volumeContainerName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client VolumeContainersClient) CreateOrUpdatePreparer(deviceName string, volumeContainerName string, parameters VolumeContainer, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeContainersClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeContainersClient) CreateOrUpdateResponder(resp *http.Response) (result VolumeContainer, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the volume container. This method may poll for completion.
|
||||
// Polling can be canceled by passing the cancel channel argument. The channel
|
||||
// will be used to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the name of the volume
|
||||
// container. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client VolumeContainersClient) Delete(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(deviceName, volumeContainerName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client VolumeContainersClient) DeletePreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeContainersClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeContainersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get gets the properties of the specified volume container name.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the name of the volume
|
||||
// container. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client VolumeContainersClient) Get(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (result VolumeContainer, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(deviceName, volumeContainerName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client VolumeContainersClient) GetPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeContainersClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeContainersClient) GetResponder(resp *http.Response) (result VolumeContainer, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevice gets all the volume containers in a device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client VolumeContainersClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result VolumeContainerList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice")
|
||||
}
|
||||
|
||||
req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListByDevice", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevicePreparer prepares the ListByDevice request.
|
||||
func (client VolumeContainersClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByDeviceSender sends the ListByDevice request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeContainersClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByDeviceResponder handles the response to the ListByDevice request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeContainersClient) ListByDeviceResponder(resp *http.Response) (result VolumeContainerList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetricDefinition gets the metric definitions for the specified volume
|
||||
// container.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client VolumeContainersClient) ListMetricDefinition(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition")
|
||||
}
|
||||
|
||||
req, err := client.ListMetricDefinitionPreparer(deviceName, volumeContainerName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMetricDefinitionSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListMetricDefinitionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetricDefinition", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetricDefinitionPreparer prepares the ListMetricDefinition request.
|
||||
func (client VolumeContainersClient) ListMetricDefinitionPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/metricsDefinitions", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeContainersClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeContainersClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetrics gets the metrics for the specified volume container.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. resourceGroupName is the resource group name managerName is the
|
||||
// manager name filter is oData Filter options
|
||||
func (client VolumeContainersClient) ListMetrics(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, filter string) (result MetricList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics")
|
||||
}
|
||||
|
||||
req, err := client.ListMetricsPreparer(deviceName, volumeContainerName, resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMetricsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListMetricsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumeContainersClient", "ListMetrics", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetricsPreparer prepares the ListMetrics request.
|
||||
func (client VolumeContainersClient) ListMetricsPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"$filter": autorest.Encode("query", filter),
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/metrics", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListMetricsSender sends the ListMetrics request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumeContainersClient) ListMetricsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListMetricsResponder handles the response to the ListMetrics request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumeContainersClient) ListMetricsResponder(resp *http.Response) (result MetricList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+626
@@ -0,0 +1,626 @@
|
||||
package storsimple8000series
|
||||
|
||||
// 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 1.1.0.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// VolumesClient is the client for the Volumes methods of the
|
||||
// Storsimple8000series service.
|
||||
type VolumesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewVolumesClient creates an instance of the VolumesClient client.
|
||||
func NewVolumesClient(subscriptionID string) VolumesClient {
|
||||
return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewVolumesClientWithBaseURI creates an instance of the VolumesClient client.
|
||||
func NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient {
|
||||
return VolumesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// CreateOrUpdate creates or updates the volume. This method may poll for
|
||||
// completion. Polling can be canceled by passing the cancel channel argument.
|
||||
// The channel will be used to cancel polling and any outstanding HTTP
|
||||
// requests.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. volumeName is the volume name. parameters is volume to be created or
|
||||
// updated. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client VolumesClient) CreateOrUpdate(deviceName string, volumeContainerName string, volumeName string, parameters Volume, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan Volume, <-chan error) {
|
||||
resultChan := make(chan Volume, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: parameters,
|
||||
Constraints: []validation.Constraint{{Target: "parameters.VolumeProperties", Name: validation.Null, Rule: true,
|
||||
Chain: []validation.Constraint{{Target: "parameters.VolumeProperties.SizeInBytes", Name: validation.Null, Rule: true, Chain: nil},
|
||||
{Target: "parameters.VolumeProperties.AccessControlRecordIds", Name: validation.Null, Rule: true, Chain: nil},
|
||||
}}}},
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result Volume
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.CreateOrUpdatePreparer(deviceName, volumeContainerName, volumeName, parameters, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateOrUpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateOrUpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "CreateOrUpdate", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
|
||||
func (client VolumesClient) CreateOrUpdatePreparer(deviceName string, volumeContainerName string, volumeName string, parameters Volume, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}", pathParameters),
|
||||
autorest.WithJSON(parameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// Delete deletes the volume. This method may poll for completion. Polling can
|
||||
// be canceled by passing the cancel channel argument. The channel will be used
|
||||
// to cancel polling and any outstanding HTTP requests.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. volumeName is the volume name. resourceGroupName is the resource group
|
||||
// name managerName is the manager name
|
||||
func (client VolumesClient) Delete(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (<-chan autorest.Response, <-chan error) {
|
||||
resultChan := make(chan autorest.Response, 1)
|
||||
errChan := make(chan error, 1)
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
errChan <- validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "Delete")
|
||||
close(errChan)
|
||||
close(resultChan)
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
go func() {
|
||||
var err error
|
||||
var result autorest.Response
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errChan <- err
|
||||
}
|
||||
resultChan <- result
|
||||
close(resultChan)
|
||||
close(errChan)
|
||||
}()
|
||||
req, err := client.DeletePreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName, cancel)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
}()
|
||||
return resultChan, errChan
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client VolumesClient) DeletePreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, cancel <-chan struct{}) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{Cancel: cancel})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client,
|
||||
req,
|
||||
azure.DoPollForAsynchronous(client.PollingDelay))
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get returns the properties of the specified volume name.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. volumeName is the volume name. resourceGroupName is the resource group
|
||||
// name managerName is the manager name
|
||||
func (client VolumesClient) Get(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (result Volume, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client VolumesClient) GetPreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevice retrieves all the volumes in a device.
|
||||
//
|
||||
// deviceName is the device name resourceGroupName is the resource group name
|
||||
// managerName is the manager name
|
||||
func (client VolumesClient) ListByDevice(deviceName string, resourceGroupName string, managerName string) (result VolumeList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListByDevice")
|
||||
}
|
||||
|
||||
req, err := client.ListByDevicePreparer(deviceName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByDevice", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByDeviceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByDevice", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByDeviceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByDevice", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByDevicePreparer prepares the ListByDevice request.
|
||||
func (client VolumesClient) ListByDevicePreparer(deviceName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByDeviceSender sends the ListByDevice request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) ListByDeviceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByDeviceResponder handles the response to the ListByDevice request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) ListByDeviceResponder(resp *http.Response) (result VolumeList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByVolumeContainer retrieves all the volumes in a volume container.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. resourceGroupName is the resource group name managerName is the
|
||||
// manager name
|
||||
func (client VolumesClient) ListByVolumeContainer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (result VolumeList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer")
|
||||
}
|
||||
|
||||
req, err := client.ListByVolumeContainerPreparer(deviceName, volumeContainerName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByVolumeContainerSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByVolumeContainerResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListByVolumeContainer", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByVolumeContainerPreparer prepares the ListByVolumeContainer request.
|
||||
func (client VolumesClient) ListByVolumeContainerPreparer(deviceName string, volumeContainerName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByVolumeContainerSender sends the ListByVolumeContainer request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) ListByVolumeContainerSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByVolumeContainerResponder handles the response to the ListByVolumeContainer request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) ListByVolumeContainerResponder(resp *http.Response) (result VolumeList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetricDefinition gets the metric definitions for the specified volume.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. volumeName is the volume name. resourceGroupName is the resource group
|
||||
// name managerName is the manager name
|
||||
func (client VolumesClient) ListMetricDefinition(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (result MetricDefinitionList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition")
|
||||
}
|
||||
|
||||
req, err := client.ListMetricDefinitionPreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMetricDefinitionSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListMetricDefinitionResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetricDefinition", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetricDefinitionPreparer prepares the ListMetricDefinition request.
|
||||
func (client VolumesClient) ListMetricDefinitionPreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}/metricsDefinitions", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListMetricDefinitionSender sends the ListMetricDefinition request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) ListMetricDefinitionSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListMetricDefinitionResponder handles the response to the ListMetricDefinition request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) ListMetricDefinitionResponder(resp *http.Response) (result MetricDefinitionList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetrics gets the metrics for the specified volume.
|
||||
//
|
||||
// deviceName is the device name volumeContainerName is the volume container
|
||||
// name. volumeName is the volume name. resourceGroupName is the resource group
|
||||
// name managerName is the manager name filter is oData Filter options
|
||||
func (client VolumesClient) ListMetrics(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, filter string) (result MetricList, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: managerName,
|
||||
Constraints: []validation.Constraint{{Target: "managerName", Name: validation.MaxLength, Rule: 50, Chain: nil},
|
||||
{Target: "managerName", Name: validation.MinLength, Rule: 2, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "storsimple8000series.VolumesClient", "ListMetrics")
|
||||
}
|
||||
|
||||
req, err := client.ListMetricsPreparer(deviceName, volumeContainerName, volumeName, resourceGroupName, managerName, filter)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetrics", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMetricsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetrics", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListMetricsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "storsimple8000series.VolumesClient", "ListMetrics", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMetricsPreparer prepares the ListMetrics request.
|
||||
func (client VolumesClient) ListMetricsPreparer(deviceName string, volumeContainerName string, volumeName string, resourceGroupName string, managerName string, filter string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"deviceName": deviceName,
|
||||
"managerName": managerName,
|
||||
"resourceGroupName": resourceGroupName,
|
||||
"subscriptionId": client.SubscriptionID,
|
||||
"volumeContainerName": volumeContainerName,
|
||||
"volumeName": volumeName,
|
||||
}
|
||||
|
||||
const APIVersion = "2017-06-01"
|
||||
queryParameters := map[string]interface{}{
|
||||
"$filter": autorest.Encode("query", filter),
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorSimple/managers/{managerName}/devices/{deviceName}/volumeContainers/{volumeContainerName}/volumes/{volumeName}/metrics", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListMetricsSender sends the ListMetrics request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client VolumesClient) ListMetricsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListMetricsResponder handles the response to the ListMetrics request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client VolumesClient) ListMetricsResponder(resp *http.Response) (result MetricList, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user