1package msi 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 "encoding/json" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/to" 24 "github.com/satori/go.uuid" 25 "net/http" 26) 27 28// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 29// UserAssignedIdentities enumerates the values for user assigned identities. 30type UserAssignedIdentities string 31 32const ( 33 // MicrosoftManagedIdentityuserAssignedIdentities ... 34 MicrosoftManagedIdentityuserAssignedIdentities UserAssignedIdentities = "Microsoft.ManagedIdentity/userAssignedIdentities" 35) 36 37// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 38// PossibleUserAssignedIdentitiesValues returns an array of possible values for the UserAssignedIdentities const type. 39func PossibleUserAssignedIdentitiesValues() []UserAssignedIdentities { 40 return []UserAssignedIdentities{MicrosoftManagedIdentityuserAssignedIdentities} 41} 42 43// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 44// CloudError an error response from the ManagedServiceIdentity service. 45type CloudError struct { 46 // Error - A list of additional details about the error. 47 Error *CloudErrorBody `json:"error,omitempty"` 48} 49 50// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 51// CloudErrorBody an error response from the ManagedServiceIdentity service. 52type CloudErrorBody struct { 53 // Code - An identifier for the error. 54 Code *string `json:"code,omitempty"` 55 // Message - A message describing the error, intended to be suitable for display in a user interface. 56 Message *string `json:"message,omitempty"` 57 // Target - The target of the particular error. For example, the name of the property in error. 58 Target *string `json:"target,omitempty"` 59 // Details - A list of additional details about the error. 60 Details *[]CloudErrorBody `json:"details,omitempty"` 61} 62 63// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 64// Identity describes an identity resource. 65type Identity struct { 66 autorest.Response `json:"-"` 67 // ID - The id of the created identity. 68 ID *string `json:"id,omitempty"` 69 // Name - The name of the created identity. 70 Name *string `json:"name,omitempty"` 71 // Location - The Azure region where the identity lives. 72 Location *string `json:"location,omitempty"` 73 // Tags - Resource tags 74 Tags map[string]*string `json:"tags"` 75 // IdentityProperties - The properties associated with the identity. 76 *IdentityProperties `json:"properties,omitempty"` 77 // Type - The type of resource i.e. Microsoft.ManagedIdentity/userAssignedIdentities. Possible values include: 'MicrosoftManagedIdentityuserAssignedIdentities' 78 Type UserAssignedIdentities `json:"type,omitempty"` 79} 80 81// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 82// MarshalJSON is the custom marshaler for Identity. 83func (i Identity) MarshalJSON() ([]byte, error) { 84 objectMap := make(map[string]interface{}) 85 if i.ID != nil { 86 objectMap["id"] = i.ID 87 } 88 if i.Name != nil { 89 objectMap["name"] = i.Name 90 } 91 if i.Location != nil { 92 objectMap["location"] = i.Location 93 } 94 if i.Tags != nil { 95 objectMap["tags"] = i.Tags 96 } 97 if i.IdentityProperties != nil { 98 objectMap["properties"] = i.IdentityProperties 99 } 100 if i.Type != "" { 101 objectMap["type"] = i.Type 102 } 103 return json.Marshal(objectMap) 104} 105 106// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 107// UnmarshalJSON is the custom unmarshaler for Identity struct. 108func (i *Identity) UnmarshalJSON(body []byte) error { 109 var m map[string]*json.RawMessage 110 err := json.Unmarshal(body, &m) 111 if err != nil { 112 return err 113 } 114 for k, v := range m { 115 switch k { 116 case "id": 117 if v != nil { 118 var ID string 119 err = json.Unmarshal(*v, &ID) 120 if err != nil { 121 return err 122 } 123 i.ID = &ID 124 } 125 case "name": 126 if v != nil { 127 var name string 128 err = json.Unmarshal(*v, &name) 129 if err != nil { 130 return err 131 } 132 i.Name = &name 133 } 134 case "location": 135 if v != nil { 136 var location string 137 err = json.Unmarshal(*v, &location) 138 if err != nil { 139 return err 140 } 141 i.Location = &location 142 } 143 case "tags": 144 if v != nil { 145 var tags map[string]*string 146 err = json.Unmarshal(*v, &tags) 147 if err != nil { 148 return err 149 } 150 i.Tags = tags 151 } 152 case "properties": 153 if v != nil { 154 var identityProperties IdentityProperties 155 err = json.Unmarshal(*v, &identityProperties) 156 if err != nil { 157 return err 158 } 159 i.IdentityProperties = &identityProperties 160 } 161 case "type": 162 if v != nil { 163 var typeVar UserAssignedIdentities 164 err = json.Unmarshal(*v, &typeVar) 165 if err != nil { 166 return err 167 } 168 i.Type = typeVar 169 } 170 } 171 } 172 173 return nil 174} 175 176// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 177// IdentityProperties the properties associated with the identity. 178type IdentityProperties struct { 179 // TenantID - The id of the tenant which the identity belongs to. 180 TenantID *uuid.UUID `json:"tenantId,omitempty"` 181 // PrincipalID - The id of the service principal object associated with the created identity. 182 PrincipalID *uuid.UUID `json:"principalId,omitempty"` 183 // ClientID - The id of the app associated with the identity. This is a random generated UUID by MSI. 184 ClientID *uuid.UUID `json:"clientId,omitempty"` 185 // ClientSecretURL - The ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials. 186 ClientSecretURL *string `json:"clientSecretUrl,omitempty"` 187} 188 189// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 190// Operation operation supported by the Microsoft.ManagedIdentity REST API. 191type Operation struct { 192 // Name - The name of the REST Operation. This is of the format {provider}/{resource}/{operation}. 193 Name *string `json:"name,omitempty"` 194 // Display - The object that describes the operation. 195 Display *OperationDisplay `json:"display,omitempty"` 196} 197 198// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 199// OperationDisplay the object that describes the operation. 200type OperationDisplay struct { 201 // Provider - Friendly name of the resource provider. 202 Provider *string `json:"provider,omitempty"` 203 // Operation - The type of operation. For example: read, write, delete. 204 Operation *string `json:"operation,omitempty"` 205 // Resource - The resource type on which the operation is performed. 206 Resource *string `json:"resource,omitempty"` 207 // Description - A description of the operation. 208 Description *string `json:"description,omitempty"` 209} 210 211// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 212// OperationListResult a list of operations supported by Microsoft.ManagedIdentity Resource Provider. 213type OperationListResult struct { 214 autorest.Response `json:"-"` 215 // Value - A list of operations supported by Microsoft.ManagedIdentity Resource Provider. 216 Value *[]Operation `json:"value,omitempty"` 217 // NextLink - The url to get the next page of results, if any. 218 NextLink *string `json:"nextLink,omitempty"` 219} 220 221// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 222// OperationListResultIterator provides access to a complete listing of Operation values. 223type OperationListResultIterator struct { 224 i int 225 page OperationListResultPage 226} 227 228// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 229// Next advances to the next value. If there was an error making 230// the request the iterator does not advance and the error is returned. 231func (iter *OperationListResultIterator) Next() error { 232 iter.i++ 233 if iter.i < len(iter.page.Values()) { 234 return nil 235 } 236 err := iter.page.Next() 237 if err != nil { 238 iter.i-- 239 return err 240 } 241 iter.i = 0 242 return nil 243} 244 245// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 246// NotDone returns true if the enumeration should be started or is not yet complete. 247func (iter OperationListResultIterator) NotDone() bool { 248 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 249} 250 251// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 252// Response returns the raw server response from the last page request. 253func (iter OperationListResultIterator) Response() OperationListResult { 254 return iter.page.Response() 255} 256 257// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 258// Value returns the current value or a zero-initialized value if the 259// iterator has advanced beyond the end of the collection. 260func (iter OperationListResultIterator) Value() Operation { 261 if !iter.page.NotDone() { 262 return Operation{} 263 } 264 return iter.page.Values()[iter.i] 265} 266 267// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 268// IsEmpty returns true if the ListResult contains no values. 269func (olr OperationListResult) IsEmpty() bool { 270 return olr.Value == nil || len(*olr.Value) == 0 271} 272 273// operationListResultPreparer prepares a request to retrieve the next set of results. 274// It returns nil if no more results exist. 275func (olr OperationListResult) operationListResultPreparer() (*http.Request, error) { 276 if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 { 277 return nil, nil 278 } 279 return autorest.Prepare(&http.Request{}, 280 autorest.AsJSON(), 281 autorest.AsGet(), 282 autorest.WithBaseURL(to.String(olr.NextLink))) 283} 284 285// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 286// OperationListResultPage contains a page of Operation values. 287type OperationListResultPage struct { 288 fn func(OperationListResult) (OperationListResult, error) 289 olr OperationListResult 290} 291 292// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 293// Next advances to the next page of values. If there was an error making 294// the request the page does not advance and the error is returned. 295func (page *OperationListResultPage) Next() error { 296 next, err := page.fn(page.olr) 297 if err != nil { 298 return err 299 } 300 page.olr = next 301 return nil 302} 303 304// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 305// NotDone returns true if the page enumeration should be started or is not yet complete. 306func (page OperationListResultPage) NotDone() bool { 307 return !page.olr.IsEmpty() 308} 309 310// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 311// Response returns the raw server response from the last page request. 312func (page OperationListResultPage) Response() OperationListResult { 313 return page.olr 314} 315 316// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 317// Values returns the slice of values for the current page or nil if there are no values. 318func (page OperationListResultPage) Values() []Operation { 319 if page.olr.IsEmpty() { 320 return nil 321 } 322 return *page.olr.Value 323} 324 325// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 326// UserAssignedIdentitiesListResult values returned by the List operation. 327type UserAssignedIdentitiesListResult struct { 328 autorest.Response `json:"-"` 329 // Value - The collection of userAssignedIdentities returned by the listing operation. 330 Value *[]Identity `json:"value,omitempty"` 331 // NextLink - The url to get the next page of results, if any. 332 NextLink *string `json:"nextLink,omitempty"` 333} 334 335// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 336// UserAssignedIdentitiesListResultIterator provides access to a complete listing of Identity values. 337type UserAssignedIdentitiesListResultIterator struct { 338 i int 339 page UserAssignedIdentitiesListResultPage 340} 341 342// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 343// Next advances to the next value. If there was an error making 344// the request the iterator does not advance and the error is returned. 345func (iter *UserAssignedIdentitiesListResultIterator) Next() error { 346 iter.i++ 347 if iter.i < len(iter.page.Values()) { 348 return nil 349 } 350 err := iter.page.Next() 351 if err != nil { 352 iter.i-- 353 return err 354 } 355 iter.i = 0 356 return nil 357} 358 359// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 360// NotDone returns true if the enumeration should be started or is not yet complete. 361func (iter UserAssignedIdentitiesListResultIterator) NotDone() bool { 362 return iter.page.NotDone() && iter.i < len(iter.page.Values()) 363} 364 365// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 366// Response returns the raw server response from the last page request. 367func (iter UserAssignedIdentitiesListResultIterator) Response() UserAssignedIdentitiesListResult { 368 return iter.page.Response() 369} 370 371// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 372// Value returns the current value or a zero-initialized value if the 373// iterator has advanced beyond the end of the collection. 374func (iter UserAssignedIdentitiesListResultIterator) Value() Identity { 375 if !iter.page.NotDone() { 376 return Identity{} 377 } 378 return iter.page.Values()[iter.i] 379} 380 381// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 382// IsEmpty returns true if the ListResult contains no values. 383func (uailr UserAssignedIdentitiesListResult) IsEmpty() bool { 384 return uailr.Value == nil || len(*uailr.Value) == 0 385} 386 387// userAssignedIdentitiesListResultPreparer prepares a request to retrieve the next set of results. 388// It returns nil if no more results exist. 389func (uailr UserAssignedIdentitiesListResult) userAssignedIdentitiesListResultPreparer() (*http.Request, error) { 390 if uailr.NextLink == nil || len(to.String(uailr.NextLink)) < 1 { 391 return nil, nil 392 } 393 return autorest.Prepare(&http.Request{}, 394 autorest.AsJSON(), 395 autorest.AsGet(), 396 autorest.WithBaseURL(to.String(uailr.NextLink))) 397} 398 399// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 400// UserAssignedIdentitiesListResultPage contains a page of Identity values. 401type UserAssignedIdentitiesListResultPage struct { 402 fn func(UserAssignedIdentitiesListResult) (UserAssignedIdentitiesListResult, error) 403 uailr UserAssignedIdentitiesListResult 404} 405 406// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 407// Next advances to the next page of values. If there was an error making 408// the request the page does not advance and the error is returned. 409func (page *UserAssignedIdentitiesListResultPage) Next() error { 410 next, err := page.fn(page.uailr) 411 if err != nil { 412 return err 413 } 414 page.uailr = next 415 return nil 416} 417 418// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 419// NotDone returns true if the page enumeration should be started or is not yet complete. 420func (page UserAssignedIdentitiesListResultPage) NotDone() bool { 421 return !page.uailr.IsEmpty() 422} 423 424// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 425// Response returns the raw server response from the last page request. 426func (page UserAssignedIdentitiesListResultPage) Response() UserAssignedIdentitiesListResult { 427 return page.uailr 428} 429 430// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/msi/mgmt/2015-08-31-preview/msi instead. 431// Values returns the slice of values for the current page or nil if there are no values. 432func (page UserAssignedIdentitiesListResultPage) Values() []Identity { 433 if page.uailr.IsEmpty() { 434 return nil 435 } 436 return *page.uailr.Value 437} 438