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
"encoding/json"
2017-12-03 21:01:25 +01:00
"github.com/Azure/go-autorest/autorest"
2018-01-23 19:40:42 +01:00
"github.com/Azure/go-autorest/autorest/azure"
2017-12-03 21:01:25 +01:00
"github.com/Azure/go-autorest/autorest/to"
"net/http"
)
// ApplianceArtifactType enumerates the values for appliance artifact type.
type ApplianceArtifactType string
const (
2018-01-23 19:40:42 +01:00
// Custom ...
2017-12-03 21:01:25 +01:00
Custom ApplianceArtifactType = "Custom"
2018-01-23 19:40:42 +01:00
// Template ...
2017-12-03 21:01:25 +01:00
Template ApplianceArtifactType = "Template"
)
2018-03-30 11:42:11 +02:00
// PossibleApplianceArtifactTypeValues returns an array of possible values for the ApplianceArtifactType const type.
func PossibleApplianceArtifactTypeValues ( ) [ ] ApplianceArtifactType {
return [ ] ApplianceArtifactType { Custom , Template }
}
2017-12-03 21:01:25 +01:00
// ApplianceLockLevel enumerates the values for appliance lock level.
type ApplianceLockLevel string
const (
2018-01-23 19:40:42 +01:00
// CanNotDelete ...
2017-12-03 21:01:25 +01:00
CanNotDelete ApplianceLockLevel = "CanNotDelete"
2018-01-23 19:40:42 +01:00
// None ...
2017-12-03 21:01:25 +01:00
None ApplianceLockLevel = "None"
2018-01-23 19:40:42 +01:00
// ReadOnly ...
2017-12-03 21:01:25 +01:00
ReadOnly ApplianceLockLevel = "ReadOnly"
)
2018-03-30 11:42:11 +02:00
// PossibleApplianceLockLevelValues returns an array of possible values for the ApplianceLockLevel const type.
func PossibleApplianceLockLevelValues ( ) [ ] ApplianceLockLevel {
return [ ] ApplianceLockLevel { CanNotDelete , None , ReadOnly }
}
2017-12-03 21:01:25 +01:00
// ProvisioningState enumerates the values for provisioning state.
type ProvisioningState string
const (
2018-01-23 19:40:42 +01:00
// Accepted ...
2017-12-03 21:01:25 +01:00
Accepted ProvisioningState = "Accepted"
2018-01-23 19:40:42 +01:00
// Canceled ...
2017-12-03 21:01:25 +01:00
Canceled ProvisioningState = "Canceled"
2018-01-23 19:40:42 +01:00
// Created ...
2017-12-03 21:01:25 +01:00
Created ProvisioningState = "Created"
2018-01-23 19:40:42 +01:00
// Creating ...
2017-12-03 21:01:25 +01:00
Creating ProvisioningState = "Creating"
2018-01-23 19:40:42 +01:00
// Deleted ...
2017-12-03 21:01:25 +01:00
Deleted ProvisioningState = "Deleted"
2018-01-23 19:40:42 +01:00
// Deleting ...
2017-12-03 21:01:25 +01:00
Deleting ProvisioningState = "Deleting"
2018-01-23 19:40:42 +01:00
// Failed ...
2017-12-03 21:01:25 +01:00
Failed ProvisioningState = "Failed"
2018-01-23 19:40:42 +01:00
// Ready ...
2017-12-03 21:01:25 +01:00
Ready ProvisioningState = "Ready"
2018-01-23 19:40:42 +01:00
// Running ...
2017-12-03 21:01:25 +01:00
Running ProvisioningState = "Running"
2018-01-23 19:40:42 +01:00
// Succeeded ...
2017-12-03 21:01:25 +01:00
Succeeded ProvisioningState = "Succeeded"
2018-01-23 19:40:42 +01:00
// Updating ...
2017-12-03 21:01:25 +01:00
Updating ProvisioningState = "Updating"
)
2018-03-30 11:42:11 +02:00
// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
func PossibleProvisioningStateValues ( ) [ ] ProvisioningState {
return [ ] ProvisioningState { Accepted , Canceled , Created , Creating , Deleted , Deleting , Failed , Ready , Running , Succeeded , Updating }
}
2017-12-03 21:01:25 +01:00
// ResourceIdentityType enumerates the values for resource identity type.
type ResourceIdentityType string
const (
2018-01-23 19:40:42 +01:00
// SystemAssigned ...
2017-12-03 21:01:25 +01:00
SystemAssigned ResourceIdentityType = "SystemAssigned"
)
2018-03-30 11:42:11 +02:00
// PossibleResourceIdentityTypeValues returns an array of possible values for the ResourceIdentityType const type.
func PossibleResourceIdentityTypeValues ( ) [ ] ResourceIdentityType {
return [ ] ResourceIdentityType { SystemAssigned }
}
2018-01-23 19:40:42 +01:00
// Appliance information about appliance.
2017-12-03 21:01:25 +01:00
type Appliance struct {
2018-01-23 19:40:42 +01:00
autorest . Response ` json:"-" `
2018-03-30 11:42:11 +02:00
// ApplianceProperties - The appliance properties.
* ApplianceProperties ` json:"properties,omitempty" `
// Plan - The plan information.
Plan * Plan ` json:"plan,omitempty" `
// Kind - The kind of the appliance. Allowed values are MarketPlace and ServiceCatalog.
Kind * string ` json:"kind,omitempty" `
// ManagedBy - ID of the resource that manages this resource.
ManagedBy * string ` json:"managedBy,omitempty" `
// Sku - The SKU of the resource.
Sku * Sku ` json:"sku,omitempty" `
// Identity - The identity of the resource.
Identity * Identity ` json:"identity,omitempty" `
2018-01-23 19:40:42 +01:00
// ID - Resource ID
ID * string ` json:"id,omitempty" `
// Name - Resource name
Name * string ` json:"name,omitempty" `
// Type - Resource type
Type * string ` json:"type,omitempty" `
// Location - Resource location
Location * string ` json:"location,omitempty" `
// Tags - Resource tags
2018-03-30 11:42:11 +02:00
Tags map [ string ] * string ` json:"tags" `
2017-12-03 21:01:25 +01:00
}
2018-03-30 11:42:11 +02:00
// MarshalJSON is the custom marshaler for Appliance.
func ( a Appliance ) MarshalJSON ( ) ( [ ] byte , error ) {
objectMap := make ( map [ string ] interface { } )
if a . ApplianceProperties != nil {
objectMap [ "properties" ] = a . ApplianceProperties
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Plan != nil {
objectMap [ "plan" ] = a . Plan
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Kind != nil {
objectMap [ "kind" ] = a . Kind
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . ManagedBy != nil {
objectMap [ "managedBy" ] = a . ManagedBy
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Sku != nil {
objectMap [ "sku" ] = a . Sku
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Identity != nil {
objectMap [ "identity" ] = a . Identity
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . ID != nil {
objectMap [ "id" ] = a . ID
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Name != nil {
objectMap [ "name" ] = a . Name
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Type != nil {
objectMap [ "type" ] = a . Type
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Location != nil {
objectMap [ "location" ] = a . Location
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if a . Tags != nil {
objectMap [ "tags" ] = a . Tags
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
return json . Marshal ( objectMap )
}
2018-01-23 19:40:42 +01:00
2018-03-30 11:42:11 +02:00
// UnmarshalJSON is the custom unmarshaler for Appliance struct.
func ( a * Appliance ) UnmarshalJSON ( body [ ] byte ) error {
var m map [ string ] * json . RawMessage
err := json . Unmarshal ( body , & m )
if err != nil {
return err
}
for k , v := range m {
switch k {
case "properties" :
if v != nil {
var applianceProperties ApplianceProperties
err = json . Unmarshal ( * v , & applianceProperties )
if err != nil {
return err
}
a . ApplianceProperties = & applianceProperties
}
case "plan" :
if v != nil {
var plan Plan
err = json . Unmarshal ( * v , & plan )
if err != nil {
return err
}
a . Plan = & plan
}
case "kind" :
if v != nil {
var kind string
err = json . Unmarshal ( * v , & kind )
if err != nil {
return err
}
a . Kind = & kind
}
case "managedBy" :
if v != nil {
var managedBy string
err = json . Unmarshal ( * v , & managedBy )
if err != nil {
return err
}
a . ManagedBy = & managedBy
}
case "sku" :
if v != nil {
var sku Sku
err = json . Unmarshal ( * v , & sku )
if err != nil {
return err
}
a . Sku = & sku
}
case "identity" :
if v != nil {
var identity Identity
err = json . Unmarshal ( * v , & identity )
if err != nil {
return err
}
a . Identity = & identity
}
case "id" :
if v != nil {
var ID string
err = json . Unmarshal ( * v , & ID )
if err != nil {
return err
}
a . ID = & ID
}
case "name" :
if v != nil {
var name string
err = json . Unmarshal ( * v , & name )
if err != nil {
return err
}
a . Name = & name
}
case "type" :
if v != nil {
var typeVar string
err = json . Unmarshal ( * v , & typeVar )
if err != nil {
return err
}
a . Type = & typeVar
}
case "location" :
if v != nil {
var location string
err = json . Unmarshal ( * v , & location )
if err != nil {
return err
}
a . Location = & location
}
case "tags" :
if v != nil {
var tags map [ string ] * string
err = json . Unmarshal ( * v , & tags )
if err != nil {
return err
}
a . Tags = tags
}
2018-01-23 19:40:42 +01:00
}
}
return nil
}
// ApplianceArtifact appliance artifact.
2017-12-03 21:01:25 +01:00
type ApplianceArtifact struct {
2018-01-23 19:40:42 +01:00
// Name - The appliance artifact name.
Name * string ` json:"name,omitempty" `
// URI - The appliance artifact blob uri.
URI * string ` json:"uri,omitempty" `
// Type - The the appliance artifact type. Possible values include: 'Template', 'Custom'
2017-12-03 21:01:25 +01:00
Type ApplianceArtifactType ` json:"type,omitempty" `
}
2018-01-23 19:40:42 +01:00
// ApplianceDefinition information about appliance definition.
2017-12-03 21:01:25 +01:00
type ApplianceDefinition struct {
2018-01-23 19:40:42 +01:00
autorest . Response ` json:"-" `
2018-03-30 11:42:11 +02:00
// ApplianceDefinitionProperties - The appliance definition properties.
* ApplianceDefinitionProperties ` json:"properties,omitempty" `
// ManagedBy - ID of the resource that manages this resource.
ManagedBy * string ` json:"managedBy,omitempty" `
// Sku - The SKU of the resource.
Sku * Sku ` json:"sku,omitempty" `
// Identity - The identity of the resource.
Identity * Identity ` json:"identity,omitempty" `
2018-01-23 19:40:42 +01:00
// ID - Resource ID
ID * string ` json:"id,omitempty" `
// Name - Resource name
Name * string ` json:"name,omitempty" `
// Type - Resource type
Type * string ` json:"type,omitempty" `
// Location - Resource location
Location * string ` json:"location,omitempty" `
// Tags - Resource tags
2018-03-30 11:42:11 +02:00
Tags map [ string ] * string ` json:"tags" `
2017-12-03 21:01:25 +01:00
}
2018-03-30 11:42:11 +02:00
// MarshalJSON is the custom marshaler for ApplianceDefinition.
func ( ad ApplianceDefinition ) MarshalJSON ( ) ( [ ] byte , error ) {
objectMap := make ( map [ string ] interface { } )
if ad . ApplianceDefinitionProperties != nil {
objectMap [ "properties" ] = ad . ApplianceDefinitionProperties
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . ManagedBy != nil {
objectMap [ "managedBy" ] = ad . ManagedBy
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . Sku != nil {
objectMap [ "sku" ] = ad . Sku
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . Identity != nil {
objectMap [ "identity" ] = ad . Identity
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . ID != nil {
objectMap [ "id" ] = ad . ID
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . Name != nil {
objectMap [ "name" ] = ad . Name
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . Type != nil {
objectMap [ "type" ] = ad . Type
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . Location != nil {
objectMap [ "location" ] = ad . Location
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ad . Tags != nil {
objectMap [ "tags" ] = ad . Tags
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
return json . Marshal ( objectMap )
}
2018-01-23 19:40:42 +01:00
2018-03-30 11:42:11 +02:00
// UnmarshalJSON is the custom unmarshaler for ApplianceDefinition struct.
func ( ad * ApplianceDefinition ) UnmarshalJSON ( body [ ] byte ) error {
var m map [ string ] * json . RawMessage
err := json . Unmarshal ( body , & m )
if err != nil {
return err
}
for k , v := range m {
switch k {
case "properties" :
if v != nil {
var applianceDefinitionProperties ApplianceDefinitionProperties
err = json . Unmarshal ( * v , & applianceDefinitionProperties )
if err != nil {
return err
}
ad . ApplianceDefinitionProperties = & applianceDefinitionProperties
}
case "managedBy" :
if v != nil {
var managedBy string
err = json . Unmarshal ( * v , & managedBy )
if err != nil {
return err
}
ad . ManagedBy = & managedBy
}
case "sku" :
if v != nil {
var sku Sku
err = json . Unmarshal ( * v , & sku )
if err != nil {
return err
}
ad . Sku = & sku
}
case "identity" :
if v != nil {
var identity Identity
err = json . Unmarshal ( * v , & identity )
if err != nil {
return err
}
ad . Identity = & identity
}
case "id" :
if v != nil {
var ID string
err = json . Unmarshal ( * v , & ID )
if err != nil {
return err
}
ad . ID = & ID
}
case "name" :
if v != nil {
var name string
err = json . Unmarshal ( * v , & name )
if err != nil {
return err
}
ad . Name = & name
}
case "type" :
if v != nil {
var typeVar string
err = json . Unmarshal ( * v , & typeVar )
if err != nil {
return err
}
ad . Type = & typeVar
}
case "location" :
if v != nil {
var location string
err = json . Unmarshal ( * v , & location )
if err != nil {
return err
}
ad . Location = & location
}
case "tags" :
if v != nil {
var tags map [ string ] * string
err = json . Unmarshal ( * v , & tags )
if err != nil {
return err
}
ad . Tags = tags
}
2018-01-23 19:40:42 +01:00
}
}
return nil
}
// ApplianceDefinitionListResult list of appliance definitions.
2017-12-03 21:01:25 +01:00
type ApplianceDefinitionListResult struct {
autorest . Response ` json:"-" `
2018-01-23 19:40:42 +01:00
// Value - The array of appliance definitions.
Value * [ ] ApplianceDefinition ` json:"value,omitempty" `
// NextLink - The URL to use for getting the next set of results.
NextLink * string ` json:"nextLink,omitempty" `
}
// ApplianceDefinitionListResultIterator provides access to a complete listing of ApplianceDefinition values.
type ApplianceDefinitionListResultIterator struct {
i int
page ApplianceDefinitionListResultPage
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func ( iter * ApplianceDefinitionListResultIterator ) Next ( ) error {
iter . i ++
if iter . i < len ( iter . page . Values ( ) ) {
return nil
}
err := iter . page . Next ( )
if err != nil {
iter . i --
return err
}
iter . i = 0
return nil
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func ( iter ApplianceDefinitionListResultIterator ) NotDone ( ) bool {
return iter . page . NotDone ( ) && iter . i < len ( iter . page . Values ( ) )
}
// Response returns the raw server response from the last page request.
func ( iter ApplianceDefinitionListResultIterator ) Response ( ) ApplianceDefinitionListResult {
return iter . page . Response ( )
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func ( iter ApplianceDefinitionListResultIterator ) Value ( ) ApplianceDefinition {
if ! iter . page . NotDone ( ) {
return ApplianceDefinition { }
}
return iter . page . Values ( ) [ iter . i ]
}
// IsEmpty returns true if the ListResult contains no values.
func ( adlr ApplianceDefinitionListResult ) IsEmpty ( ) bool {
return adlr . Value == nil || len ( * adlr . Value ) == 0
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// applianceDefinitionListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func ( adlr ApplianceDefinitionListResult ) applianceDefinitionListResultPreparer ( ) ( * http . Request , error ) {
if adlr . NextLink == nil || len ( to . String ( adlr . NextLink ) ) < 1 {
2017-12-03 21:01:25 +01:00
return nil , nil
}
return autorest . Prepare ( & http . Request { } ,
autorest . AsJSON ( ) ,
autorest . AsGet ( ) ,
2018-01-23 19:40:42 +01:00
autorest . WithBaseURL ( to . String ( adlr . NextLink ) ) )
}
// ApplianceDefinitionListResultPage contains a page of ApplianceDefinition values.
type ApplianceDefinitionListResultPage struct {
fn func ( ApplianceDefinitionListResult ) ( ApplianceDefinitionListResult , error )
adlr ApplianceDefinitionListResult
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func ( page * ApplianceDefinitionListResultPage ) Next ( ) error {
next , err := page . fn ( page . adlr )
if err != nil {
return err
}
page . adlr = next
return nil
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func ( page ApplianceDefinitionListResultPage ) NotDone ( ) bool {
return ! page . adlr . IsEmpty ( )
}
// Response returns the raw server response from the last page request.
func ( page ApplianceDefinitionListResultPage ) Response ( ) ApplianceDefinitionListResult {
return page . adlr
}
// Values returns the slice of values for the current page or nil if there are no values.
func ( page ApplianceDefinitionListResultPage ) Values ( ) [ ] ApplianceDefinition {
if page . adlr . IsEmpty ( ) {
return nil
}
return * page . adlr . Value
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// ApplianceDefinitionProperties the appliance definition properties.
2017-12-03 21:01:25 +01:00
type ApplianceDefinitionProperties struct {
2018-01-23 19:40:42 +01:00
// LockLevel - The appliance lock level. Possible values include: 'CanNotDelete', 'ReadOnly', 'None'
LockLevel ApplianceLockLevel ` json:"lockLevel,omitempty" `
// DisplayName - The appliance definition display name.
DisplayName * string ` json:"displayName,omitempty" `
// Authorizations - The appliance provider authorizations.
2017-12-03 21:01:25 +01:00
Authorizations * [ ] ApplianceProviderAuthorization ` json:"authorizations,omitempty" `
2018-01-23 19:40:42 +01:00
// Artifacts - The collection of appliance artifacts. The portal will use the files specified as artifacts to construct the user experience of creating an appliance from an appliance definition.
Artifacts * [ ] ApplianceArtifact ` json:"artifacts,omitempty" `
// Description - The appliance definition description.
Description * string ` json:"description,omitempty" `
// PackageFileURI - The appliance definition package file Uri.
PackageFileURI * string ` json:"packageFileUri,omitempty" `
}
// ApplianceDefinitionsCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
type ApplianceDefinitionsCreateOrUpdateByIDFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future ApplianceDefinitionsCreateOrUpdateByIDFuture ) Result ( client ApplianceDefinitionsClient ) ( ad ApplianceDefinition , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateByIDFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return ad , azure . NewAsyncOpIncompleteError ( "managedapplications.ApplianceDefinitionsCreateOrUpdateByIDFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
ad , err = client . CreateOrUpdateByIDResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateByIDFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateByIDFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
ad , err = client . CreateOrUpdateByIDResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateByIDFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
// ApplianceDefinitionsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
// long-running operation.
2018-01-23 19:40:42 +01:00
type ApplianceDefinitionsCreateOrUpdateFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future ApplianceDefinitionsCreateOrUpdateFuture ) Result ( client ApplianceDefinitionsClient ) ( ad ApplianceDefinition , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return ad , azure . NewAsyncOpIncompleteError ( "managedapplications.ApplianceDefinitionsCreateOrUpdateFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
ad , err = client . CreateOrUpdateResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
ad , err = client . CreateOrUpdateResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsCreateOrUpdateFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
// ApplianceDefinitionsDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ApplianceDefinitionsDeleteByIDFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future ApplianceDefinitionsDeleteByIDFuture ) Result ( client ApplianceDefinitionsClient ) ( ar autorest . Response , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteByIDFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return ar , azure . NewAsyncOpIncompleteError ( "managedapplications.ApplianceDefinitionsDeleteByIDFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
ar , err = client . DeleteByIDResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteByIDFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteByIDFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
ar , err = client . DeleteByIDResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteByIDFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// ApplianceDefinitionsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type ApplianceDefinitionsDeleteFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future ApplianceDefinitionsDeleteFuture ) Result ( client ApplianceDefinitionsClient ) ( ar autorest . Response , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return ar , azure . NewAsyncOpIncompleteError ( "managedapplications.ApplianceDefinitionsDeleteFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
ar , err = client . DeleteResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
ar , err = client . DeleteResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.ApplianceDefinitionsDeleteFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
// ApplianceListResult list of appliances.
2017-12-03 21:01:25 +01:00
type ApplianceListResult struct {
autorest . Response ` json:"-" `
2018-01-23 19:40:42 +01:00
// Value - The array of appliances.
Value * [ ] Appliance ` json:"value,omitempty" `
// NextLink - The URL to use for getting the next set of results.
NextLink * string ` json:"nextLink,omitempty" `
}
// ApplianceListResultIterator provides access to a complete listing of Appliance values.
type ApplianceListResultIterator struct {
i int
page ApplianceListResultPage
}
// Next advances to the next value. If there was an error making
// the request the iterator does not advance and the error is returned.
func ( iter * ApplianceListResultIterator ) Next ( ) error {
iter . i ++
if iter . i < len ( iter . page . Values ( ) ) {
return nil
}
err := iter . page . Next ( )
if err != nil {
iter . i --
return err
}
iter . i = 0
return nil
}
// NotDone returns true if the enumeration should be started or is not yet complete.
func ( iter ApplianceListResultIterator ) NotDone ( ) bool {
return iter . page . NotDone ( ) && iter . i < len ( iter . page . Values ( ) )
}
// Response returns the raw server response from the last page request.
func ( iter ApplianceListResultIterator ) Response ( ) ApplianceListResult {
return iter . page . Response ( )
}
// Value returns the current value or a zero-initialized value if the
// iterator has advanced beyond the end of the collection.
func ( iter ApplianceListResultIterator ) Value ( ) Appliance {
if ! iter . page . NotDone ( ) {
return Appliance { }
}
return iter . page . Values ( ) [ iter . i ]
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// IsEmpty returns true if the ListResult contains no values.
func ( alr ApplianceListResult ) IsEmpty ( ) bool {
return alr . Value == nil || len ( * alr . Value ) == 0
}
// applianceListResultPreparer prepares a request to retrieve the next set of results.
// It returns nil if no more results exist.
func ( alr ApplianceListResult ) applianceListResultPreparer ( ) ( * http . Request , error ) {
if alr . NextLink == nil || len ( to . String ( alr . NextLink ) ) < 1 {
2017-12-03 21:01:25 +01:00
return nil , nil
}
return autorest . Prepare ( & http . Request { } ,
autorest . AsJSON ( ) ,
autorest . AsGet ( ) ,
2018-01-23 19:40:42 +01:00
autorest . WithBaseURL ( to . String ( alr . NextLink ) ) )
}
// ApplianceListResultPage contains a page of Appliance values.
type ApplianceListResultPage struct {
fn func ( ApplianceListResult ) ( ApplianceListResult , error )
alr ApplianceListResult
}
// Next advances to the next page of values. If there was an error making
// the request the page does not advance and the error is returned.
func ( page * ApplianceListResultPage ) Next ( ) error {
next , err := page . fn ( page . alr )
if err != nil {
return err
}
page . alr = next
return nil
}
// NotDone returns true if the page enumeration should be started or is not yet complete.
func ( page ApplianceListResultPage ) NotDone ( ) bool {
return ! page . alr . IsEmpty ( )
}
// Response returns the raw server response from the last page request.
func ( page ApplianceListResultPage ) Response ( ) ApplianceListResult {
return page . alr
}
// Values returns the slice of values for the current page or nil if there are no values.
func ( page ApplianceListResultPage ) Values ( ) [ ] Appliance {
if page . alr . IsEmpty ( ) {
return nil
}
return * page . alr . Value
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// AppliancePatchable information about appliance.
2017-12-03 21:01:25 +01:00
type AppliancePatchable struct {
2018-03-30 11:42:11 +02:00
// AppliancePropertiesPatchable - The appliance properties.
* AppliancePropertiesPatchable ` json:"properties,omitempty" `
// Plan - The plan information.
Plan * PlanPatchable ` json:"plan,omitempty" `
// Kind - The kind of the appliance. Allowed values are MarketPlace and ServiceCatalog.
Kind * string ` json:"kind,omitempty" `
// ManagedBy - ID of the resource that manages this resource.
ManagedBy * string ` json:"managedBy,omitempty" `
// Sku - The SKU of the resource.
Sku * Sku ` json:"sku,omitempty" `
// Identity - The identity of the resource.
Identity * Identity ` json:"identity,omitempty" `
2018-01-23 19:40:42 +01:00
// ID - Resource ID
ID * string ` json:"id,omitempty" `
// Name - Resource name
Name * string ` json:"name,omitempty" `
// Type - Resource type
Type * string ` json:"type,omitempty" `
// Location - Resource location
Location * string ` json:"location,omitempty" `
// Tags - Resource tags
2018-03-30 11:42:11 +02:00
Tags map [ string ] * string ` json:"tags" `
2017-12-03 21:01:25 +01:00
}
2018-03-30 11:42:11 +02:00
// MarshalJSON is the custom marshaler for AppliancePatchable.
func ( ap AppliancePatchable ) MarshalJSON ( ) ( [ ] byte , error ) {
objectMap := make ( map [ string ] interface { } )
if ap . AppliancePropertiesPatchable != nil {
objectMap [ "properties" ] = ap . AppliancePropertiesPatchable
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Plan != nil {
objectMap [ "plan" ] = ap . Plan
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Kind != nil {
objectMap [ "kind" ] = ap . Kind
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . ManagedBy != nil {
objectMap [ "managedBy" ] = ap . ManagedBy
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Sku != nil {
objectMap [ "sku" ] = ap . Sku
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Identity != nil {
objectMap [ "identity" ] = ap . Identity
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . ID != nil {
objectMap [ "id" ] = ap . ID
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Name != nil {
objectMap [ "name" ] = ap . Name
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Type != nil {
objectMap [ "type" ] = ap . Type
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Location != nil {
objectMap [ "location" ] = ap . Location
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
if ap . Tags != nil {
objectMap [ "tags" ] = ap . Tags
2018-01-23 19:40:42 +01:00
}
2018-03-30 11:42:11 +02:00
return json . Marshal ( objectMap )
}
2018-01-23 19:40:42 +01:00
2018-03-30 11:42:11 +02:00
// UnmarshalJSON is the custom unmarshaler for AppliancePatchable struct.
func ( ap * AppliancePatchable ) UnmarshalJSON ( body [ ] byte ) error {
var m map [ string ] * json . RawMessage
err := json . Unmarshal ( body , & m )
if err != nil {
return err
}
for k , v := range m {
switch k {
case "properties" :
if v != nil {
var appliancePropertiesPatchable AppliancePropertiesPatchable
err = json . Unmarshal ( * v , & appliancePropertiesPatchable )
if err != nil {
return err
}
ap . AppliancePropertiesPatchable = & appliancePropertiesPatchable
}
case "plan" :
if v != nil {
var plan PlanPatchable
err = json . Unmarshal ( * v , & plan )
if err != nil {
return err
}
ap . Plan = & plan
}
case "kind" :
if v != nil {
var kind string
err = json . Unmarshal ( * v , & kind )
if err != nil {
return err
}
ap . Kind = & kind
}
case "managedBy" :
if v != nil {
var managedBy string
err = json . Unmarshal ( * v , & managedBy )
if err != nil {
return err
}
ap . ManagedBy = & managedBy
}
case "sku" :
if v != nil {
var sku Sku
err = json . Unmarshal ( * v , & sku )
if err != nil {
return err
}
ap . Sku = & sku
}
case "identity" :
if v != nil {
var identity Identity
err = json . Unmarshal ( * v , & identity )
if err != nil {
return err
}
ap . Identity = & identity
}
case "id" :
if v != nil {
var ID string
err = json . Unmarshal ( * v , & ID )
if err != nil {
return err
}
ap . ID = & ID
}
case "name" :
if v != nil {
var name string
err = json . Unmarshal ( * v , & name )
if err != nil {
return err
}
ap . Name = & name
}
case "type" :
if v != nil {
var typeVar string
err = json . Unmarshal ( * v , & typeVar )
if err != nil {
return err
}
ap . Type = & typeVar
}
case "location" :
if v != nil {
var location string
err = json . Unmarshal ( * v , & location )
if err != nil {
return err
}
ap . Location = & location
}
case "tags" :
if v != nil {
var tags map [ string ] * string
err = json . Unmarshal ( * v , & tags )
if err != nil {
return err
}
ap . Tags = tags
}
2018-01-23 19:40:42 +01:00
}
}
return nil
}
// ApplianceProperties the appliance properties.
2017-12-03 21:01:25 +01:00
type ApplianceProperties struct {
2018-01-23 19:40:42 +01:00
// ManagedResourceGroupID - The managed resource group Id.
ManagedResourceGroupID * string ` json:"managedResourceGroupId,omitempty" `
// ApplianceDefinitionID - The fully qualified path of appliance definition Id.
ApplianceDefinitionID * string ` json:"applianceDefinitionId,omitempty" `
// Parameters - Name and value pairs that define the appliance parameters. It can be a JObject or a well formed JSON string.
2018-03-30 11:42:11 +02:00
Parameters interface { } ` json:"parameters,omitempty" `
2018-01-23 19:40:42 +01:00
// Outputs - Name and value pairs that define the appliance outputs.
2018-03-30 11:42:11 +02:00
Outputs interface { } ` json:"outputs,omitempty" `
2018-01-23 19:40:42 +01:00
// ProvisioningState - The appliance provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
ProvisioningState ProvisioningState ` json:"provisioningState,omitempty" `
// UIDefinitionURI - The blob URI where the UI definition file is located.
UIDefinitionURI * string ` json:"uiDefinitionUri,omitempty" `
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// AppliancePropertiesPatchable the appliance properties.
2017-12-03 21:01:25 +01:00
type AppliancePropertiesPatchable struct {
2018-01-23 19:40:42 +01:00
// ManagedResourceGroupID - The managed resource group Id.
ManagedResourceGroupID * string ` json:"managedResourceGroupId,omitempty" `
// ApplianceDefinitionID - The fully qualified path of appliance definition Id.
ApplianceDefinitionID * string ` json:"applianceDefinitionId,omitempty" `
// Parameters - Name and value pairs that define the appliance parameters. It can be a JObject or a well formed JSON string.
2018-03-30 11:42:11 +02:00
Parameters interface { } ` json:"parameters,omitempty" `
2018-01-23 19:40:42 +01:00
// Outputs - Name and value pairs that define the appliance outputs.
2018-03-30 11:42:11 +02:00
Outputs interface { } ` json:"outputs,omitempty" `
2018-01-23 19:40:42 +01:00
// ProvisioningState - The appliance provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
ProvisioningState ProvisioningState ` json:"provisioningState,omitempty" `
// UIDefinitionURI - The blob URI where the UI definition file is located.
UIDefinitionURI * string ` json:"uiDefinitionUri,omitempty" `
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// ApplianceProviderAuthorization the appliance provider authorization.
2017-12-03 21:01:25 +01:00
type ApplianceProviderAuthorization struct {
2018-01-23 19:40:42 +01:00
// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the appliance resources.
PrincipalID * string ` json:"principalId,omitempty" `
// RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the appliance's container resource group. This role definition cannot have permission to delete the resource group.
2017-12-03 21:01:25 +01:00
RoleDefinitionID * string ` json:"roleDefinitionId,omitempty" `
}
2018-01-23 19:40:42 +01:00
// AppliancesCreateOrUpdateByIDFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
type AppliancesCreateOrUpdateByIDFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future AppliancesCreateOrUpdateByIDFuture ) Result ( client AppliancesClient ) ( a Appliance , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateByIDFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return a , azure . NewAsyncOpIncompleteError ( "managedapplications.AppliancesCreateOrUpdateByIDFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
a , err = client . CreateOrUpdateByIDResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateByIDFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateByIDFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
a , err = client . CreateOrUpdateByIDResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateByIDFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
// AppliancesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
// operation.
2018-01-23 19:40:42 +01:00
type AppliancesCreateOrUpdateFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future AppliancesCreateOrUpdateFuture ) Result ( client AppliancesClient ) ( a Appliance , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return a , azure . NewAsyncOpIncompleteError ( "managedapplications.AppliancesCreateOrUpdateFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
a , err = client . CreateOrUpdateResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
a , err = client . CreateOrUpdateResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesCreateOrUpdateFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
// AppliancesDeleteByIDFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type AppliancesDeleteByIDFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future AppliancesDeleteByIDFuture ) Result ( client AppliancesClient ) ( ar autorest . Response , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteByIDFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return ar , azure . NewAsyncOpIncompleteError ( "managedapplications.AppliancesDeleteByIDFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
ar , err = client . DeleteByIDResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteByIDFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteByIDFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
ar , err = client . DeleteByIDResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteByIDFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
// AppliancesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
type AppliancesDeleteFuture struct {
azure . Future
req * http . Request
}
// Result returns the result of the asynchronous operation.
// If the operation has not completed it will return an error.
func ( future AppliancesDeleteFuture ) Result ( client AppliancesClient ) ( ar autorest . Response , err error ) {
var done bool
done , err = future . Done ( client )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteFuture" , "Result" , future . Response ( ) , "Polling failure" )
2018-01-23 19:40:42 +01:00
return
}
if ! done {
2018-03-30 11:42:11 +02:00
return ar , azure . NewAsyncOpIncompleteError ( "managedapplications.AppliancesDeleteFuture" )
2018-01-23 19:40:42 +01:00
}
if future . PollingMethod ( ) == azure . PollingLocation {
ar , err = client . DeleteResponder ( future . Response ( ) )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteFuture" , "Result" , future . Response ( ) , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
2018-03-30 11:42:11 +02:00
var req * http . Request
2018-01-23 19:40:42 +01:00
var resp * http . Response
2018-03-30 11:42:11 +02:00
if future . PollingURL ( ) != "" {
req , err = http . NewRequest ( http . MethodGet , future . PollingURL ( ) , nil )
if err != nil {
return
}
} else {
req = autorest . ChangeToGet ( future . req )
}
resp , err = autorest . SendWithSender ( client , req ,
2018-01-23 19:40:42 +01:00
autorest . DoRetryForStatusCodes ( client . RetryAttempts , client . RetryDuration , autorest . StatusCodesForRetry ... ) )
if err != nil {
2018-03-30 11:42:11 +02:00
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteFuture" , "Result" , resp , "Failure sending request" )
2018-01-23 19:40:42 +01:00
return
}
ar , err = client . DeleteResponder ( resp )
2018-03-30 11:42:11 +02:00
if err != nil {
err = autorest . NewErrorWithError ( err , "managedapplications.AppliancesDeleteFuture" , "Result" , resp , "Failure responding to request" )
}
2018-01-23 19:40:42 +01:00
return
}
// ErrorResponse error reponse indicates ARM appliance is not able to process the incoming request. The reason is
2017-12-03 21:01:25 +01:00
// provided in the error message.
type ErrorResponse struct {
2018-01-23 19:40:42 +01:00
// HTTPStatus - Http status code.
HTTPStatus * string ` json:"httpStatus,omitempty" `
// ErrorCode - Error code.
ErrorCode * string ` json:"errorCode,omitempty" `
// ErrorMessage - Error message indicating why the operation failed.
2017-12-03 21:01:25 +01:00
ErrorMessage * string ` json:"errorMessage,omitempty" `
}
2018-01-23 19:40:42 +01:00
// GenericResource resource information.
2017-12-03 21:01:25 +01:00
type GenericResource struct {
2018-03-30 11:42:11 +02:00
// ManagedBy - ID of the resource that manages this resource.
ManagedBy * string ` json:"managedBy,omitempty" `
// Sku - The SKU of the resource.
Sku * Sku ` json:"sku,omitempty" `
// Identity - The identity of the resource.
Identity * Identity ` json:"identity,omitempty" `
2018-01-23 19:40:42 +01:00
// ID - Resource ID
ID * string ` json:"id,omitempty" `
// Name - Resource name
Name * string ` json:"name,omitempty" `
// Type - Resource type
Type * string ` json:"type,omitempty" `
// Location - Resource location
Location * string ` json:"location,omitempty" `
// Tags - Resource tags
2018-03-30 11:42:11 +02:00
Tags map [ string ] * string ` json:"tags" `
}
// MarshalJSON is the custom marshaler for GenericResource.
func ( gr GenericResource ) MarshalJSON ( ) ( [ ] byte , error ) {
objectMap := make ( map [ string ] interface { } )
if gr . ManagedBy != nil {
objectMap [ "managedBy" ] = gr . ManagedBy
}
if gr . Sku != nil {
objectMap [ "sku" ] = gr . Sku
}
if gr . Identity != nil {
objectMap [ "identity" ] = gr . Identity
}
if gr . ID != nil {
objectMap [ "id" ] = gr . ID
}
if gr . Name != nil {
objectMap [ "name" ] = gr . Name
}
if gr . Type != nil {
objectMap [ "type" ] = gr . Type
}
if gr . Location != nil {
objectMap [ "location" ] = gr . Location
}
if gr . Tags != nil {
objectMap [ "tags" ] = gr . Tags
}
return json . Marshal ( objectMap )
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// Identity identity for the resource.
2017-12-03 21:01:25 +01:00
type Identity struct {
2018-01-23 19:40:42 +01:00
// PrincipalID - The principal ID of resource identity.
PrincipalID * string ` json:"principalId,omitempty" `
// TenantID - The tenant ID of resource.
TenantID * string ` json:"tenantId,omitempty" `
// Type - The identity type. Possible values include: 'SystemAssigned'
Type ResourceIdentityType ` json:"type,omitempty" `
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// Plan plan for the appliance.
2017-12-03 21:01:25 +01:00
type Plan struct {
2018-01-23 19:40:42 +01:00
// Name - The plan name.
Name * string ` json:"name,omitempty" `
// Publisher - The publisher ID.
Publisher * string ` json:"publisher,omitempty" `
// Product - The product code.
Product * string ` json:"product,omitempty" `
// PromotionCode - The promotion code.
2017-12-03 21:01:25 +01:00
PromotionCode * string ` json:"promotionCode,omitempty" `
2018-01-23 19:40:42 +01:00
// Version - The plan's version.
Version * string ` json:"version,omitempty" `
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// PlanPatchable plan for the appliance.
2017-12-03 21:01:25 +01:00
type PlanPatchable struct {
2018-01-23 19:40:42 +01:00
// Name - The plan name.
Name * string ` json:"name,omitempty" `
// Publisher - The publisher ID.
Publisher * string ` json:"publisher,omitempty" `
// Product - The product code.
Product * string ` json:"product,omitempty" `
// PromotionCode - The promotion code.
2017-12-03 21:01:25 +01:00
PromotionCode * string ` json:"promotionCode,omitempty" `
2018-01-23 19:40:42 +01:00
// Version - The plan's version.
Version * string ` json:"version,omitempty" `
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// Resource resource information.
2017-12-03 21:01:25 +01:00
type Resource struct {
2018-01-23 19:40:42 +01:00
// ID - Resource ID
ID * string ` json:"id,omitempty" `
// Name - Resource name
Name * string ` json:"name,omitempty" `
// Type - Resource type
Type * string ` json:"type,omitempty" `
// Location - Resource location
Location * string ` json:"location,omitempty" `
// Tags - Resource tags
2018-03-30 11:42:11 +02:00
Tags map [ string ] * string ` json:"tags" `
}
// MarshalJSON is the custom marshaler for Resource.
func ( r Resource ) MarshalJSON ( ) ( [ ] byte , error ) {
objectMap := make ( map [ string ] interface { } )
if r . ID != nil {
objectMap [ "id" ] = r . ID
}
if r . Name != nil {
objectMap [ "name" ] = r . Name
}
if r . Type != nil {
objectMap [ "type" ] = r . Type
}
if r . Location != nil {
objectMap [ "location" ] = r . Location
}
if r . Tags != nil {
objectMap [ "tags" ] = r . Tags
}
return json . Marshal ( objectMap )
2017-12-03 21:01:25 +01:00
}
2018-01-23 19:40:42 +01:00
// Sku SKU for the resource.
2017-12-03 21:01:25 +01:00
type Sku struct {
2018-01-23 19:40:42 +01:00
// Name - The SKU name.
Name * string ` json:"name,omitempty" `
// Tier - The SKU tier.
Tier * string ` json:"tier,omitempty" `
// Size - The SKU size.
Size * string ` json:"size,omitempty" `
// Family - The SKU family.
Family * string ` json:"family,omitempty" `
// Model - The SKU model.
Model * string ` json:"model,omitempty" `
// Capacity - The SKU capacity.
Capacity * int32 ` json:"capacity,omitempty" `
2017-12-03 21:01:25 +01:00
}