2017-12-03 21:01:25 +01:00
package managedapplications
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
2018-01-23 19:40:42 +01:00
"context"
2017-12-03 21:01:25 +01:00
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/validation"
"net/http"
)
// ApplianceDefinitionsClient is the ARM managed applications (appliances)
type ApplianceDefinitionsClient struct {
2018-01-23 19:40:42 +01:00
BaseClient
2017-12-03 21:01:25 +01:00
}
// NewApplianceDefinitionsClient creates an instance of the ApplianceDefinitionsClient client.
func NewApplianceDefinitionsClient ( subscriptionID string ) ApplianceDefinitionsClient {
return NewApplianceDefinitionsClientWithBaseURI ( DefaultBaseURI , subscriptionID )
}
// NewApplianceDefinitionsClientWithBaseURI creates an instance of the ApplianceDefinitionsClient client.
func NewApplianceDefinitionsClientWithBaseURI ( baseURI string , subscriptionID string ) ApplianceDefinitionsClient {
return ApplianceDefinitionsClient { NewWithBaseURI ( baseURI , subscriptionID ) }
}
2018-01-23 19:40:42 +01:00
// CreateOrUpdate creates a new appliance definition.
2017-12-03 21:01:25 +01:00
//
2018-03-30 11:42:11 +02:00
// resourceGroupName is the name of the resource group. The name is case insensitive. applianceDefinitionName is
// the name of the appliance definition. parameters is parameters supplied to the create or update an appliance
// definition.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) CreateOrUpdate ( ctx context . Context , resourceGroupName string , applianceDefinitionName string , parameters ApplianceDefinition ) ( result ApplianceDefinitionsCreateOrUpdateFuture , err error ) {
2017-12-03 21:01:25 +01:00
if err := validation . Validate ( [ ] validation . Validation {
{ TargetValue : resourceGroupName ,
Constraints : [ ] validation . Constraint { { Target : "resourceGroupName" , Name : validation . MaxLength , Rule : 90 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . MinLength , Rule : 1 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . Pattern , Rule : ` ^[-\w\._\(\)]+$ ` , Chain : nil } } } ,
{ TargetValue : applianceDefinitionName ,
Constraints : [ ] validation . Constraint { { Target : "applianceDefinitionName" , Name : validation . MaxLength , Rule : 64 , Chain : nil } ,
{ Target : "applianceDefinitionName" , Name : validation . MinLength , Rule : 3 , Chain : nil } } } ,
{ TargetValue : parameters ,
Constraints : [ ] validation . Constraint { { Target : "parameters.ApplianceDefinitionProperties" , Name : validation . Null , Rule : true ,
Chain : [ ] validation . Constraint { { Target : "parameters.ApplianceDefinitionProperties.Authorizations" , Name : validation . Null , Rule : true , Chain : nil } ,
{ Target : "parameters.ApplianceDefinitionProperties.PackageFileURI" , Name : validation . Null , Rule : true , Chain : nil } ,
} } } } } ) ; err != nil {
2018-03-30 11:42:11 +02:00
return result , validation . NewError ( "managedapplications.ApplianceDefinitionsClient" , "CreateOrUpdate" , err . Error ( ) )
2018-01-23 19:40:42 +01:00
}
req , err := client . CreateOrUpdatePreparer ( ctx , resourceGroupName , applianceDefinitionName , parameters )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "CreateOrUpdate" , nil , "Failure preparing request" )
return
}
result , err = client . CreateOrUpdateSender ( req )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "CreateOrUpdate" , result . Response ( ) , "Failure sending request" )
return
}
return
2017-12-03 21:01:25 +01:00
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) CreateOrUpdatePreparer ( ctx context . Context , resourceGroupName string , applianceDefinitionName string , parameters ApplianceDefinition ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"applianceDefinitionName" : autorest . Encode ( "path" , applianceDefinitionName ) ,
"resourceGroupName" : autorest . Encode ( "path" , resourceGroupName ) ,
"subscriptionId" : autorest . Encode ( "path" , client . SubscriptionID ) ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
2018-03-30 11:42:11 +02:00
autorest . AsContentType ( "application/json; charset=utf-8" ) ,
2017-12-03 21:01:25 +01:00
autorest . AsPut ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions/{applianceDefinitionName}" , pathParameters ) ,
autorest . WithJSON ( parameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) CreateOrUpdateSender ( req * http . Request ) ( future ApplianceDefinitionsCreateOrUpdateFuture , err error ) {
sender := autorest . DecorateSender ( client , azure . DoRetryWithRegistration ( client . Client ) )
future . Future = azure . NewFuture ( req )
future . req = req
_ , err = future . Done ( sender )
if err != nil {
return
}
err = autorest . Respond ( future . Response ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusCreated ) )
return
2017-12-03 21:01:25 +01:00
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) CreateOrUpdateResponder ( resp * http . Response ) ( result ApplianceDefinition , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusCreated ) ,
autorest . ByUnmarshallingJSON ( & result ) ,
autorest . ByClosing ( ) )
result . Response = autorest . Response { Response : resp }
return
}
2018-01-23 19:40:42 +01:00
// CreateOrUpdateByID creates a new appliance definition.
2017-12-03 21:01:25 +01:00
//
2018-03-30 11:42:11 +02:00
// applianceDefinitionID is the fully qualified ID of the appliance definition, including the appliance name and
// the appliance definition resource type. Use the format,
2017-12-03 21:01:25 +01:00
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name}
// parameters is parameters supplied to the create or update an appliance definition.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) CreateOrUpdateByID ( ctx context . Context , applianceDefinitionID string , parameters ApplianceDefinition ) ( result ApplianceDefinitionsCreateOrUpdateByIDFuture , err error ) {
2017-12-03 21:01:25 +01:00
if err := validation . Validate ( [ ] validation . Validation {
{ TargetValue : parameters ,
Constraints : [ ] validation . Constraint { { Target : "parameters.ApplianceDefinitionProperties" , Name : validation . Null , Rule : true ,
Chain : [ ] validation . Constraint { { Target : "parameters.ApplianceDefinitionProperties.Authorizations" , Name : validation . Null , Rule : true , Chain : nil } ,
{ Target : "parameters.ApplianceDefinitionProperties.PackageFileURI" , Name : validation . Null , Rule : true , Chain : nil } ,
} } } } } ) ; err != nil {
2018-03-30 11:42:11 +02:00
return result , validation . NewError ( "managedapplications.ApplianceDefinitionsClient" , "CreateOrUpdateByID" , err . Error ( ) )
2018-01-23 19:40:42 +01:00
}
req , err := client . CreateOrUpdateByIDPreparer ( ctx , applianceDefinitionID , parameters )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "CreateOrUpdateByID" , nil , "Failure preparing request" )
return
}
result , err = client . CreateOrUpdateByIDSender ( req )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "CreateOrUpdateByID" , result . Response ( ) , "Failure sending request" )
return
}
return
2017-12-03 21:01:25 +01:00
}
// CreateOrUpdateByIDPreparer prepares the CreateOrUpdateByID request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) CreateOrUpdateByIDPreparer ( ctx context . Context , applianceDefinitionID string , parameters ApplianceDefinition ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"applianceDefinitionId" : applianceDefinitionID ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
2018-03-30 11:42:11 +02:00
autorest . AsContentType ( "application/json; charset=utf-8" ) ,
2017-12-03 21:01:25 +01:00
autorest . AsPut ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/{applianceDefinitionId}" , pathParameters ) ,
autorest . WithJSON ( parameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// CreateOrUpdateByIDSender sends the CreateOrUpdateByID request. The method will close the
// http.Response Body if it receives an error.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) CreateOrUpdateByIDSender ( req * http . Request ) ( future ApplianceDefinitionsCreateOrUpdateByIDFuture , err error ) {
sender := autorest . DecorateSender ( client , autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
future . Future = azure . NewFuture ( req )
future . req = req
_ , err = future . Done ( sender )
if err != nil {
return
}
err = autorest . Respond ( future . Response ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusCreated ) )
return
2017-12-03 21:01:25 +01:00
}
// CreateOrUpdateByIDResponder handles the response to the CreateOrUpdateByID request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) CreateOrUpdateByIDResponder ( resp * http . Response ) ( result ApplianceDefinition , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusCreated ) ,
autorest . ByUnmarshallingJSON ( & result ) ,
autorest . ByClosing ( ) )
result . Response = autorest . Response { Response : resp }
return
}
2018-01-23 19:40:42 +01:00
// Delete deletes the appliance definition.
2017-12-03 21:01:25 +01:00
//
2018-03-30 11:42:11 +02:00
// resourceGroupName is the name of the resource group. The name is case insensitive. applianceDefinitionName is
// the name of the appliance definition to delete.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) Delete ( ctx context . Context , resourceGroupName string , applianceDefinitionName string ) ( result ApplianceDefinitionsDeleteFuture , err error ) {
2017-12-03 21:01:25 +01:00
if err := validation . Validate ( [ ] validation . Validation {
{ TargetValue : resourceGroupName ,
Constraints : [ ] validation . Constraint { { Target : "resourceGroupName" , Name : validation . MaxLength , Rule : 90 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . MinLength , Rule : 1 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . Pattern , Rule : ` ^[-\w\._\(\)]+$ ` , Chain : nil } } } ,
{ TargetValue : applianceDefinitionName ,
Constraints : [ ] validation . Constraint { { Target : "applianceDefinitionName" , Name : validation . MaxLength , Rule : 64 , Chain : nil } ,
{ Target : "applianceDefinitionName" , Name : validation . MinLength , Rule : 3 , Chain : nil } } } } ) ; err != nil {
2018-03-30 11:42:11 +02:00
return result , validation . NewError ( "managedapplications.ApplianceDefinitionsClient" , "Delete" , err . Error ( ) )
2018-01-23 19:40:42 +01:00
}
req , err := client . DeletePreparer ( ctx , resourceGroupName , applianceDefinitionName )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "Delete" , nil , "Failure preparing request" )
return
}
result , err = client . DeleteSender ( req )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "Delete" , result . Response ( ) , "Failure sending request" )
return
}
return
2017-12-03 21:01:25 +01:00
}
// DeletePreparer prepares the Delete request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) DeletePreparer ( ctx context . Context , resourceGroupName string , applianceDefinitionName string ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"applianceDefinitionName" : autorest . Encode ( "path" , applianceDefinitionName ) ,
"resourceGroupName" : autorest . Encode ( "path" , resourceGroupName ) ,
"subscriptionId" : autorest . Encode ( "path" , client . SubscriptionID ) ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
autorest . AsDelete ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions/{applianceDefinitionName}" , pathParameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) DeleteSender ( req * http . Request ) ( future ApplianceDefinitionsDeleteFuture , err error ) {
sender := autorest . DecorateSender ( client , azure . DoRetryWithRegistration ( client . Client ) )
future . Future = azure . NewFuture ( req )
future . req = req
_ , err = future . Done ( sender )
if err != nil {
return
}
err = autorest . Respond ( future . Response ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusAccepted , http . StatusNoContent ) )
return
2017-12-03 21:01:25 +01:00
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) DeleteResponder ( resp * http . Response ) ( result autorest . Response , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
2018-01-23 19:40:42 +01:00
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusAccepted , http . StatusNoContent ) ,
2017-12-03 21:01:25 +01:00
autorest . ByClosing ( ) )
result . Response = resp
return
}
2018-01-23 19:40:42 +01:00
// DeleteByID deletes the appliance definition.
2017-12-03 21:01:25 +01:00
//
2018-03-30 11:42:11 +02:00
// applianceDefinitionID is the fully qualified ID of the appliance definition, including the appliance name and
// the appliance definition resource type. Use the format,
2017-12-03 21:01:25 +01:00
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name}
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) DeleteByID ( ctx context . Context , applianceDefinitionID string ) ( result ApplianceDefinitionsDeleteByIDFuture , err error ) {
req , err := client . DeleteByIDPreparer ( ctx , applianceDefinitionID )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "DeleteByID" , nil , "Failure preparing request" )
return
}
result , err = client . DeleteByIDSender ( req )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "DeleteByID" , result . Response ( ) , "Failure sending request" )
return
}
return
2017-12-03 21:01:25 +01:00
}
// DeleteByIDPreparer prepares the DeleteByID request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) DeleteByIDPreparer ( ctx context . Context , applianceDefinitionID string ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"applianceDefinitionId" : applianceDefinitionID ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
autorest . AsDelete ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/{applianceDefinitionId}" , pathParameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// DeleteByIDSender sends the DeleteByID request. The method will close the
// http.Response Body if it receives an error.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) DeleteByIDSender ( req * http . Request ) ( future ApplianceDefinitionsDeleteByIDFuture , err error ) {
sender := autorest . DecorateSender ( client , autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
future . Future = azure . NewFuture ( req )
future . req = req
_ , err = future . Done ( sender )
if err != nil {
return
}
err = autorest . Respond ( future . Response ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusAccepted , http . StatusNoContent ) )
return
2017-12-03 21:01:25 +01:00
}
// DeleteByIDResponder handles the response to the DeleteByID request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) DeleteByIDResponder ( resp * http . Response ) ( result autorest . Response , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
2018-01-23 19:40:42 +01:00
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusAccepted , http . StatusNoContent ) ,
2017-12-03 21:01:25 +01:00
autorest . ByClosing ( ) )
result . Response = resp
return
}
// Get gets the appliance definition.
//
2018-03-30 11:42:11 +02:00
// resourceGroupName is the name of the resource group. The name is case insensitive. applianceDefinitionName is
// the name of the appliance definition.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) Get ( ctx context . Context , resourceGroupName string , applianceDefinitionName string ) ( result ApplianceDefinition , err error ) {
2017-12-03 21:01:25 +01:00
if err := validation . Validate ( [ ] validation . Validation {
{ TargetValue : resourceGroupName ,
Constraints : [ ] validation . Constraint { { Target : "resourceGroupName" , Name : validation . MaxLength , Rule : 90 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . MinLength , Rule : 1 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . Pattern , Rule : ` ^[-\w\._\(\)]+$ ` , Chain : nil } } } ,
{ TargetValue : applianceDefinitionName ,
Constraints : [ ] validation . Constraint { { Target : "applianceDefinitionName" , Name : validation . MaxLength , Rule : 64 , Chain : nil } ,
{ Target : "applianceDefinitionName" , Name : validation . MinLength , Rule : 3 , Chain : nil } } } } ) ; err != nil {
2018-03-30 11:42:11 +02:00
return result , validation . NewError ( "managedapplications.ApplianceDefinitionsClient" , "Get" , err . Error ( ) )
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
req , err := client . GetPreparer ( ctx , resourceGroupName , applianceDefinitionName )
2017-12-03 21:01:25 +01:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "Get" , nil , "Failure preparing request" )
return
}
resp , err := client . GetSender ( req )
if err != nil {
result . Response = autorest . Response { Response : resp }
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "Get" , resp , "Failure sending request" )
return
}
result , err = client . GetResponder ( resp )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "Get" , resp , "Failure responding to request" )
}
return
}
// GetPreparer prepares the Get request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) GetPreparer ( ctx context . Context , resourceGroupName string , applianceDefinitionName string ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"applianceDefinitionName" : autorest . Encode ( "path" , applianceDefinitionName ) ,
"resourceGroupName" : autorest . Encode ( "path" , resourceGroupName ) ,
"subscriptionId" : autorest . Encode ( "path" , client . SubscriptionID ) ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
autorest . AsGet ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions/{applianceDefinitionName}" , pathParameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func ( client ApplianceDefinitionsClient ) GetSender ( req * http . Request ) ( * http . Response , error ) {
2018-01-23 19:40:42 +01:00
return autorest . SendWithSender ( client , req ,
2017-12-03 21:01:25 +01:00
azure . DoRetryWithRegistration ( client . Client ) )
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) GetResponder ( resp * http . Response ) ( result ApplianceDefinition , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusNotFound ) ,
autorest . ByUnmarshallingJSON ( & result ) ,
autorest . ByClosing ( ) )
result . Response = autorest . Response { Response : resp }
return
}
// GetByID gets the appliance definition.
//
2018-03-30 11:42:11 +02:00
// applianceDefinitionID is the fully qualified ID of the appliance definition, including the appliance name and
// the appliance definition resource type. Use the format,
2017-12-03 21:01:25 +01:00
// /subscriptions/{guid}/resourceGroups/{resource-group-name}/Microsoft.Solutions/applianceDefinitions/{applianceDefinition-name}
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) GetByID ( ctx context . Context , applianceDefinitionID string ) ( result ApplianceDefinition , err error ) {
req , err := client . GetByIDPreparer ( ctx , applianceDefinitionID )
2017-12-03 21:01:25 +01:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "GetByID" , nil , "Failure preparing request" )
return
}
resp , err := client . GetByIDSender ( req )
if err != nil {
result . Response = autorest . Response { Response : resp }
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "GetByID" , resp , "Failure sending request" )
return
}
result , err = client . GetByIDResponder ( resp )
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "GetByID" , resp , "Failure responding to request" )
}
return
}
// GetByIDPreparer prepares the GetByID request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) GetByIDPreparer ( ctx context . Context , applianceDefinitionID string ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"applianceDefinitionId" : applianceDefinitionID ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
autorest . AsGet ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/{applianceDefinitionId}" , pathParameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// GetByIDSender sends the GetByID request. The method will close the
// http.Response Body if it receives an error.
func ( client ApplianceDefinitionsClient ) GetByIDSender ( req * http . Request ) ( * http . Response , error ) {
2018-01-23 19:40:42 +01:00
return autorest . SendWithSender ( client , req ,
2017-12-03 21:01:25 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
}
// GetByIDResponder handles the response to the GetByID request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) GetByIDResponder ( resp * http . Response ) ( result ApplianceDefinition , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK , http . StatusNotFound ) ,
autorest . ByUnmarshallingJSON ( & result ) ,
autorest . ByClosing ( ) )
result . Response = autorest . Response { Response : resp }
return
}
// ListByResourceGroup lists the appliance definitions in a resource group.
//
// resourceGroupName is the name of the resource group. The name is case insensitive.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) ListByResourceGroup ( ctx context . Context , resourceGroupName string ) ( result ApplianceDefinitionListResultPage , err error ) {
2017-12-03 21:01:25 +01:00
if err := validation . Validate ( [ ] validation . Validation {
{ TargetValue : resourceGroupName ,
Constraints : [ ] validation . Constraint { { Target : "resourceGroupName" , Name : validation . MaxLength , Rule : 90 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . MinLength , Rule : 1 , Chain : nil } ,
{ Target : "resourceGroupName" , Name : validation . Pattern , Rule : ` ^[-\w\._\(\)]+$ ` , Chain : nil } } } } ) ; err != nil {
2018-03-30 11:42:11 +02:00
return result , validation . NewError ( "managedapplications.ApplianceDefinitionsClient" , "ListByResourceGroup" , err . Error ( ) )
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
result . fn = client . listByResourceGroupNextResults
req , err := client . ListByResourceGroupPreparer ( ctx , resourceGroupName )
2017-12-03 21:01:25 +01:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "ListByResourceGroup" , nil , "Failure preparing request" )
return
}
resp , err := client . ListByResourceGroupSender ( req )
if err != nil {
2018-01-23 19:40:42 +01:00
result . adlr . Response = autorest . Response { Response : resp }
2017-12-03 21:01:25 +01:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "ListByResourceGroup" , resp , "Failure sending request" )
return
}
2018-01-23 19:40:42 +01:00
result . adlr , err = client . ListByResourceGroupResponder ( resp )
2017-12-03 21:01:25 +01:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "ListByResourceGroup" , resp , "Failure responding to request" )
}
return
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
2018-01-23 19:40:42 +01:00
func ( client ApplianceDefinitionsClient ) ListByResourceGroupPreparer ( ctx context . Context , resourceGroupName string ) ( * http . Request , error ) {
2017-12-03 21:01:25 +01:00
pathParameters := map [ string ] interface { } {
"resourceGroupName" : autorest . Encode ( "path" , resourceGroupName ) ,
"subscriptionId" : autorest . Encode ( "path" , client . SubscriptionID ) ,
}
const APIVersion = "2016-09-01-preview"
queryParameters := map [ string ] interface { } {
"api-version" : APIVersion ,
}
preparer := autorest . CreatePreparer (
autorest . AsGet ( ) ,
autorest . WithBaseURL ( client . BaseURI ) ,
autorest . WithPathParameters ( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applianceDefinitions" , pathParameters ) ,
autorest . WithQueryParameters ( queryParameters ) )
2018-01-23 19:40:42 +01:00
return preparer . Prepare ( ( & http . Request { } ) . WithContext ( ctx ) )
2017-12-03 21:01:25 +01:00
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func ( client ApplianceDefinitionsClient ) ListByResourceGroupSender ( req * http . Request ) ( * http . Response , error ) {
2018-01-23 19:40:42 +01:00
return autorest . SendWithSender ( client , req ,
2017-12-03 21:01:25 +01:00
azure . DoRetryWithRegistration ( client . Client ) )
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
// closes the http.Response Body.
func ( client ApplianceDefinitionsClient ) ListByResourceGroupResponder ( resp * http . Response ) ( result ApplianceDefinitionListResult , err error ) {
err = autorest . Respond (
resp ,
client . ByInspecting ( ) ,
azure . WithErrorUnlessStatusCode ( http . StatusOK ) ,
autorest . ByUnmarshallingJSON ( & result ) ,
autorest . ByClosing ( ) )
result . Response = autorest . Response { Response : resp }
return
}
2018-01-23 19:40:42 +01:00
// listByResourceGroupNextResults retrieves the next set of results, if any.
func ( client ApplianceDefinitionsClient ) listByResourceGroupNextResults ( lastResults ApplianceDefinitionListResult ) ( result ApplianceDefinitionListResult , err error ) {
req , err := lastResults . applianceDefinitionListResultPreparer ( )
2017-12-03 21:01:25 +01:00
if err != nil {
2018-01-23 19:40:42 +01:00
return result , autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "listByResourceGroupNextResults" , nil , "Failure preparing next results request" )
2017-12-03 21:01:25 +01:00
}
if req == nil {
return
}
resp , err := client . ListByResourceGroupSender ( req )
if err != nil {
result . Response = autorest . Response { Response : resp }
2018-01-23 19:40:42 +01:00
return result , autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "listByResourceGroupNextResults" , resp , "Failure sending next results request" )
2017-12-03 21:01:25 +01:00
}
result , err = client . ListByResourceGroupResponder ( resp )
if err != nil {
2018-01-23 19:40:42 +01:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsClient" , "listByResourceGroupNextResults" , resp , "Failure responding to next results request" )
2017-12-03 21:01:25 +01:00
}
return
}
2018-01-23 19:40:42 +01:00
// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
func ( client ApplianceDefinitionsClient ) ListByResourceGroupComplete ( ctx context . Context , resourceGroupName string ) ( result ApplianceDefinitionListResultIterator , err error ) {
result . page , err = client . ListByResourceGroup ( ctx , resourceGroupName )
return
2017-12-03 21:01:25 +01:00
}