1package subscriptions 2 3// Copyright (c) Microsoft and contributors. All rights reserved. 4// 5// Licensed under the Apache License, Version 2.0 (the "License"); 6// you may not use this file except in compliance with the License. 7// You may obtain a copy of the License at 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// 14// See the License for the specific language governing permissions and 15// limitations under the License. 16// 17// Code generated by Microsoft (R) AutoRest Code Generator. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "github.com/Azure/go-autorest/autorest" 22 "github.com/Azure/go-autorest/autorest/to" 23 "net/http" 24) 25 26// ListResult subscription list operation response. 27type ListResult struct { 28 autorest.Response `json:"-"` 29 // Value - Gets or sets subscriptions. 30 Value *[]Subscription `json:"value,omitempty"` 31 // NextLink - Gets or sets the URL to get the next set of results. 32 NextLink *string `json:"nextLink,omitempty"` 33} 34 35// ListResultIterator provides access to a complete listing of Subscription values. 36type ListResultIterator struct { 37 i int 38 page ListResultPage 39} 40 41// Next advances to the next value. If there was an error making 42// the request the iterator does not advance and the error is returned. 43func (iter *ListResultIterator) Next() error { 44 iter.i++ 45 if iter.i < len(iter.page.Values()) { 46 return nil 47 } 48 err := iter.page.Next() 49 if err != nil { 50 iter.i-- 51 return err 52 } 53 iter.i = 0 54 return nil 55} 56 57// NotDone returns true if the enumeration should be started or is not yet complete. 58func (iter ListResultIterator) NotDone() bool { 59 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 60} 61 62// Response returns the raw server response from the last page request. 63func (iter ListResultIterator) Response() ListResult { 64 return iter.page.Response() 65} 66 67// Value returns the current value or a zero-initialized value if the 68// iterator has advanced beyond the end of the collection. 69func (iter ListResultIterator) Value() Subscription { 70 if !iter.page.NotDone() { 71 return Subscription{} 72 } 73 return iter.page.Values()[iter.i] 74} 75 76// IsEmpty returns true if the ListResult contains no values. 77func (lr ListResult) IsEmpty() bool { 78 return lr.Value == nil || len(*lr.Value) == 0 79} 80 81// listResultPreparer prepares a request to retrieve the next set of results. 82// It returns nil if no more results exist. 83func (lr ListResult) listResultPreparer() (*http.Request, error) { 84 if lr.NextLink == nil || len(to.String(lr.NextLink)) < 1 { 85 return nil, nil 86 } 87 return autorest.Prepare(&http.Request{}, 88 autorest.AsJSON(), 89 autorest.AsGet(), 90 autorest.WithBaseURL(to.String(lr.NextLink))) 91} 92 93// ListResultPage contains a page of Subscription values. 94type ListResultPage struct { 95 fn func(ListResult) (ListResult, error) 96 lr ListResult 97} 98 99// Next advances to the next page of values. If there was an error making 100// the request the page does not advance and the error is returned. 101func (page *ListResultPage) Next() error { 102 next, err := page.fn(page.lr) 103 if err != nil { 104 return err 105 } 106 page.lr = next 107 return nil 108} 109 110// NotDone returns true if the page enumeration should be started or is not yet complete. 111func (page ListResultPage) NotDone() bool { 112 return !page.lr.IsEmpty() 113} 114 115// Response returns the raw server response from the last page request. 116func (page ListResultPage) Response() ListResult { 117 return page.lr 118} 119 120// Values returns the slice of values for the current page or nil if there are no values. 121func (page ListResultPage) Values() []Subscription { 122 if page.lr.IsEmpty() { 123 return nil 124 } 125 return *page.lr.Value 126} 127 128// Location location information. 129type Location struct { 130 // ID - Gets or sets the ID of the resource (/subscriptions/SubscriptionId). 131 ID *string `json:"id,omitempty"` 132 // SubscriptionID - Gets or sets the subscription Id. 133 SubscriptionID *string `json:"subscriptionId,omitempty"` 134 // Name - Gets or sets the location name 135 Name *string `json:"name,omitempty"` 136 // DisplayName - Gets or sets the display name of the location 137 DisplayName *string `json:"displayName,omitempty"` 138 // Latitude - Gets or sets the latitude of the location 139 Latitude *string `json:"latitude,omitempty"` 140 // Longitude - Gets or sets the longitude of the location 141 Longitude *string `json:"longitude,omitempty"` 142} 143 144// LocationListResult location list operation response. 145type LocationListResult struct { 146 autorest.Response `json:"-"` 147 // Value - Gets the locations. 148 Value *[]Location `json:"value,omitempty"` 149} 150 151// Policies subscription policies. 152type Policies struct { 153 // LocationPlacementID - Gets or sets the subscription location placement Id. 154 LocationPlacementID *string `json:"locationPlacementId,omitempty"` 155 // QuotaID - Gets or sets the subscription quota Id. 156 QuotaID *string `json:"quotaId,omitempty"` 157} 158 159// Subscription subscription information. 160type Subscription struct { 161 autorest.Response `json:"-"` 162 // ID - Gets or sets the ID of the resource (/subscriptions/SubscriptionId). 163 ID *string `json:"id,omitempty"` 164 // SubscriptionID - Gets or sets the subscription Id. 165 SubscriptionID *string `json:"subscriptionId,omitempty"` 166 // DisplayName - Gets or sets the subscription display name 167 DisplayName *string `json:"displayName,omitempty"` 168 // State - Gets or sets the subscription state 169 State *string `json:"state,omitempty"` 170 // SubscriptionPolicies - Gets or sets the subscription policies. 171 SubscriptionPolicies *Policies `json:"subscriptionPolicies,omitempty"` 172} 173 174// TenantIDDescription tenant Id information 175type TenantIDDescription struct { 176 // ID - Gets or sets Id 177 ID *string `json:"id,omitempty"` 178 // TenantID - Gets or sets tenantId 179 TenantID *string `json:"tenantId,omitempty"` 180} 181 182// TenantListResult tenant Ids information. 183type TenantListResult struct { 184 autorest.Response `json:"-"` 185 // Value - Gets or sets tenant Ids. 186 Value *[]TenantIDDescription `json:"value,omitempty"` 187 // NextLink - Gets or sets the URL to get the next set of results. 188 NextLink *string `json:"nextLink,omitempty"` 189} 190 191// TenantListResultIterator provides access to a complete listing of TenantIDDescription values. 192type TenantListResultIterator struct { 193 i int 194 page TenantListResultPage 195} 196 197// Next advances to the next value. If there was an error making 198// the request the iterator does not advance and the error is returned. 199func (iter *TenantListResultIterator) Next() error { 200 iter.i++ 201 if iter.i < len(iter.page.Values()) { 202 return nil 203 } 204 err := iter.page.Next() 205 if err != nil { 206 iter.i-- 207 return err 208 } 209 iter.i = 0 210 return nil 211} 212 213// NotDone returns true if the enumeration should be started or is not yet complete. 214func (iter TenantListResultIterator) NotDone() bool { 215 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 216} 217 218// Response returns the raw server response from the last page request. 219func (iter TenantListResultIterator) Response() TenantListResult { 220 return iter.page.Response() 221} 222 223// Value returns the current value or a zero-initialized value if the 224// iterator has advanced beyond the end of the collection. 225func (iter TenantListResultIterator) Value() TenantIDDescription { 226 if !iter.page.NotDone() { 227 return TenantIDDescription{} 228 } 229 return iter.page.Values()[iter.i] 230} 231 232// IsEmpty returns true if the ListResult contains no values. 233func (tlr TenantListResult) IsEmpty() bool { 234 return tlr.Value == nil || len(*tlr.Value) == 0 235} 236 237// tenantListResultPreparer prepares a request to retrieve the next set of results. 238// It returns nil if no more results exist. 239func (tlr TenantListResult) tenantListResultPreparer() (*http.Request, error) { 240 if tlr.NextLink == nil || len(to.String(tlr.NextLink)) < 1 { 241 return nil, nil 242 } 243 return autorest.Prepare(&http.Request{}, 244 autorest.AsJSON(), 245 autorest.AsGet(), 246 autorest.WithBaseURL(to.String(tlr.NextLink))) 247} 248 249// TenantListResultPage contains a page of TenantIDDescription values. 250type TenantListResultPage struct { 251 fn func(TenantListResult) (TenantListResult, error) 252 tlr TenantListResult 253} 254 255// Next advances to the next page of values. If there was an error making 256// the request the page does not advance and the error is returned. 257func (page *TenantListResultPage) Next() error { 258 next, err := page.fn(page.tlr) 259 if err != nil { 260 return err 261 } 262 page.tlr = next 263 return nil 264} 265 266// NotDone returns true if the page enumeration should be started or is not yet complete. 267func (page TenantListResultPage) NotDone() bool { 268 return !page.tlr.IsEmpty() 269} 270 271// Response returns the raw server response from the last page request. 272func (page TenantListResultPage) Response() TenantListResult { 273 return page.tlr 274} 275 276// Values returns the slice of values for the current page or nil if there are no values. 277func (page TenantListResultPage) Values() []TenantIDDescription { 278 if page.tlr.IsEmpty() { 279 return nil 280 } 281 return *page.tlr.Value 282} 283