1package containerservice 2 3// Copyright (c) Microsoft Corporation. All rights reserved. 4// Licensed under the MIT License. See License.txt in the project root for license information. 5// 6// Code generated by Microsoft (R) AutoRest Code Generator. 7// Changes may cause incorrect behavior and will be lost if the code is regenerated. 8 9import ( 10 "context" 11 "encoding/json" 12 "github.com/Azure/go-autorest/autorest" 13 "github.com/Azure/go-autorest/autorest/azure" 14 "net/http" 15) 16 17// The package's fully qualified name. 18const fqdn = "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2016-03-30/containerservice" 19 20// AgentPoolProfile profile for the container service agent pool. 21type AgentPoolProfile struct { 22 // Name - Unique name of the agent pool profile in the context of the subscription and resource group. 23 Name *string `json:"name,omitempty"` 24 // Count - Number of agents (VMs) to host docker containers. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. 25 Count *int32 `json:"count,omitempty"` 26 // VMSize - Size of agent VMs. Possible values include: 'StandardA0', 'StandardA1', 'StandardA2', 'StandardA3', 'StandardA4', 'StandardA5', 'StandardA6', 'StandardA7', 'StandardA8', 'StandardA9', 'StandardA10', 'StandardA11', 'StandardD1', 'StandardD2', 'StandardD3', 'StandardD4', 'StandardD11', 'StandardD12', 'StandardD13', 'StandardD14', 'StandardD1V2', 'StandardD2V2', 'StandardD3V2', 'StandardD4V2', 'StandardD5V2', 'StandardD11V2', 'StandardD12V2', 'StandardD13V2', 'StandardD14V2', 'StandardG1', 'StandardG2', 'StandardG3', 'StandardG4', 'StandardG5', 'StandardDS1', 'StandardDS2', 'StandardDS3', 'StandardDS4', 'StandardDS11', 'StandardDS12', 'StandardDS13', 'StandardDS14', 'StandardGS1', 'StandardGS2', 'StandardGS3', 'StandardGS4', 'StandardGS5' 27 VMSize VMSizeTypes `json:"vmSize,omitempty"` 28 // DNSPrefix - DNS prefix to be used to create the FQDN for the agent pool. 29 DNSPrefix *string `json:"dnsPrefix,omitempty"` 30 // Fqdn - READ-ONLY; FQDN for the agent pool. 31 Fqdn *string `json:"fqdn,omitempty"` 32} 33 34// MarshalJSON is the custom marshaler for AgentPoolProfile. 35func (app AgentPoolProfile) MarshalJSON() ([]byte, error) { 36 objectMap := make(map[string]interface{}) 37 if app.Name != nil { 38 objectMap["name"] = app.Name 39 } 40 if app.Count != nil { 41 objectMap["count"] = app.Count 42 } 43 if app.VMSize != "" { 44 objectMap["vmSize"] = app.VMSize 45 } 46 if app.DNSPrefix != nil { 47 objectMap["dnsPrefix"] = app.DNSPrefix 48 } 49 return json.Marshal(objectMap) 50} 51 52// ContainerService container service. 53type ContainerService struct { 54 autorest.Response `json:"-"` 55 *Properties `json:"properties,omitempty"` 56 // ID - READ-ONLY; Resource Id 57 ID *string `json:"id,omitempty"` 58 // Name - READ-ONLY; Resource name 59 Name *string `json:"name,omitempty"` 60 // Type - READ-ONLY; Resource type 61 Type *string `json:"type,omitempty"` 62 // Location - Resource location 63 Location *string `json:"location,omitempty"` 64 // Tags - Resource tags 65 Tags map[string]*string `json:"tags"` 66} 67 68// MarshalJSON is the custom marshaler for ContainerService. 69func (cs ContainerService) MarshalJSON() ([]byte, error) { 70 objectMap := make(map[string]interface{}) 71 if cs.Properties != nil { 72 objectMap["properties"] = cs.Properties 73 } 74 if cs.Location != nil { 75 objectMap["location"] = cs.Location 76 } 77 if cs.Tags != nil { 78 objectMap["tags"] = cs.Tags 79 } 80 return json.Marshal(objectMap) 81} 82 83// UnmarshalJSON is the custom unmarshaler for ContainerService struct. 84func (cs *ContainerService) UnmarshalJSON(body []byte) error { 85 var m map[string]*json.RawMessage 86 err := json.Unmarshal(body, &m) 87 if err != nil { 88 return err 89 } 90 for k, v := range m { 91 switch k { 92 case "properties": 93 if v != nil { 94 var properties Properties 95 err = json.Unmarshal(*v, &properties) 96 if err != nil { 97 return err 98 } 99 cs.Properties = &properties 100 } 101 case "id": 102 if v != nil { 103 var ID string 104 err = json.Unmarshal(*v, &ID) 105 if err != nil { 106 return err 107 } 108 cs.ID = &ID 109 } 110 case "name": 111 if v != nil { 112 var name string 113 err = json.Unmarshal(*v, &name) 114 if err != nil { 115 return err 116 } 117 cs.Name = &name 118 } 119 case "type": 120 if v != nil { 121 var typeVar string 122 err = json.Unmarshal(*v, &typeVar) 123 if err != nil { 124 return err 125 } 126 cs.Type = &typeVar 127 } 128 case "location": 129 if v != nil { 130 var location string 131 err = json.Unmarshal(*v, &location) 132 if err != nil { 133 return err 134 } 135 cs.Location = &location 136 } 137 case "tags": 138 if v != nil { 139 var tags map[string]*string 140 err = json.Unmarshal(*v, &tags) 141 if err != nil { 142 return err 143 } 144 cs.Tags = tags 145 } 146 } 147 } 148 149 return nil 150} 151 152// ContainerServicesCreateOrUpdateFutureType an abstraction for monitoring and retrieving the results of a 153// long-running operation. 154type ContainerServicesCreateOrUpdateFutureType struct { 155 azure.FutureAPI 156 // Result returns the result of the asynchronous operation. 157 // If the operation has not completed it will return an error. 158 Result func(ContainerServicesClient) (ContainerService, error) 159} 160 161// UnmarshalJSON is the custom unmarshaller for CreateFuture. 162func (future *ContainerServicesCreateOrUpdateFutureType) UnmarshalJSON(body []byte) error { 163 var azFuture azure.Future 164 if err := json.Unmarshal(body, &azFuture); err != nil { 165 return err 166 } 167 future.FutureAPI = &azFuture 168 future.Result = future.result 169 return nil 170} 171 172// result is the default implementation for ContainerServicesCreateOrUpdateFutureType.Result. 173func (future *ContainerServicesCreateOrUpdateFutureType) result(client ContainerServicesClient) (cs ContainerService, err error) { 174 var done bool 175 done, err = future.DoneWithContext(context.Background(), client) 176 if err != nil { 177 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", future.Response(), "Polling failure") 178 return 179 } 180 if !done { 181 cs.Response.Response = future.Response() 182 err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesCreateOrUpdateFutureType") 183 return 184 } 185 sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 186 if cs.Response.Response, err = future.GetResult(sender); err == nil && cs.Response.Response.StatusCode != http.StatusNoContent { 187 cs, err = client.CreateOrUpdateResponder(cs.Response.Response) 188 if err != nil { 189 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesCreateOrUpdateFutureType", "Result", cs.Response.Response, "Failure responding to request") 190 } 191 } 192 return 193} 194 195// ContainerServicesDeleteFutureType an abstraction for monitoring and retrieving the results of a 196// long-running operation. 197type ContainerServicesDeleteFutureType struct { 198 azure.FutureAPI 199 // Result returns the result of the asynchronous operation. 200 // If the operation has not completed it will return an error. 201 Result func(ContainerServicesClient) (autorest.Response, error) 202} 203 204// UnmarshalJSON is the custom unmarshaller for CreateFuture. 205func (future *ContainerServicesDeleteFutureType) UnmarshalJSON(body []byte) error { 206 var azFuture azure.Future 207 if err := json.Unmarshal(body, &azFuture); err != nil { 208 return err 209 } 210 future.FutureAPI = &azFuture 211 future.Result = future.result 212 return nil 213} 214 215// result is the default implementation for ContainerServicesDeleteFutureType.Result. 216func (future *ContainerServicesDeleteFutureType) result(client ContainerServicesClient) (ar autorest.Response, err error) { 217 var done bool 218 done, err = future.DoneWithContext(context.Background(), client) 219 if err != nil { 220 err = autorest.NewErrorWithError(err, "containerservice.ContainerServicesDeleteFutureType", "Result", future.Response(), "Polling failure") 221 return 222 } 223 if !done { 224 ar.Response = future.Response() 225 err = azure.NewAsyncOpIncompleteError("containerservice.ContainerServicesDeleteFutureType") 226 return 227 } 228 ar.Response = future.Response() 229 return 230} 231 232// DiagnosticsProfile ... 233type DiagnosticsProfile struct { 234 // VMDiagnostics - Profile for the container service VM diagnostic agent. 235 VMDiagnostics *VMDiagnostics `json:"vmDiagnostics,omitempty"` 236} 237 238// LinuxProfile profile for Linux VMs in the container service cluster. 239type LinuxProfile struct { 240 // AdminUsername - The administrator username to use for all Linux VMs 241 AdminUsername *string `json:"adminUsername,omitempty"` 242 // SSH - The ssh key configuration for Linux VMs. 243 SSH *SSHConfiguration `json:"ssh,omitempty"` 244} 245 246// ListResult the response from the List Container Services operation. 247type ListResult struct { 248 autorest.Response `json:"-"` 249 // Value - the list of container services. 250 Value *[]ContainerService `json:"value,omitempty"` 251} 252 253// MasterProfile profile for the container service master. 254type MasterProfile struct { 255 // Count - Number of masters (VMs) in the container service cluster. Allowed values are 1, 3, and 5. The default value is 1. 256 Count *int32 `json:"count,omitempty"` 257 // DNSPrefix - DNS prefix to be used to create the FQDN for master. 258 DNSPrefix *string `json:"dnsPrefix,omitempty"` 259 // Fqdn - READ-ONLY; FQDN for the master. 260 Fqdn *string `json:"fqdn,omitempty"` 261} 262 263// MarshalJSON is the custom marshaler for MasterProfile. 264func (mp MasterProfile) MarshalJSON() ([]byte, error) { 265 objectMap := make(map[string]interface{}) 266 if mp.Count != nil { 267 objectMap["count"] = mp.Count 268 } 269 if mp.DNSPrefix != nil { 270 objectMap["dnsPrefix"] = mp.DNSPrefix 271 } 272 return json.Marshal(objectMap) 273} 274 275// OrchestratorProfile profile for the container service orchestrator. 276type OrchestratorProfile struct { 277 // OrchestratorType - The orchestrator to use to manage container service cluster resources. Valid values are Swarm, DCOS, and Custom. Possible values include: 'Swarm', 'DCOS' 278 OrchestratorType OchestratorTypes `json:"orchestratorType,omitempty"` 279} 280 281// Properties properties of the container service. 282type Properties struct { 283 // ProvisioningState - READ-ONLY; the current deployment or provisioning state, which only appears in the response. 284 ProvisioningState *string `json:"provisioningState,omitempty"` 285 // OrchestratorProfile - Properties of the orchestrator. 286 OrchestratorProfile *OrchestratorProfile `json:"orchestratorProfile,omitempty"` 287 // MasterProfile - Properties of master agents. 288 MasterProfile *MasterProfile `json:"masterProfile,omitempty"` 289 // AgentPoolProfiles - Properties of the agent pool. 290 AgentPoolProfiles *[]AgentPoolProfile `json:"agentPoolProfiles,omitempty"` 291 // WindowsProfile - Properties of Windows VMs. 292 WindowsProfile *WindowsProfile `json:"windowsProfile,omitempty"` 293 // LinuxProfile - Properties of Linux VMs. 294 LinuxProfile *LinuxProfile `json:"linuxProfile,omitempty"` 295 // DiagnosticsProfile - Properties of the diagnostic agent. 296 DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` 297} 298 299// MarshalJSON is the custom marshaler for Properties. 300func (p Properties) MarshalJSON() ([]byte, error) { 301 objectMap := make(map[string]interface{}) 302 if p.OrchestratorProfile != nil { 303 objectMap["orchestratorProfile"] = p.OrchestratorProfile 304 } 305 if p.MasterProfile != nil { 306 objectMap["masterProfile"] = p.MasterProfile 307 } 308 if p.AgentPoolProfiles != nil { 309 objectMap["agentPoolProfiles"] = p.AgentPoolProfiles 310 } 311 if p.WindowsProfile != nil { 312 objectMap["windowsProfile"] = p.WindowsProfile 313 } 314 if p.LinuxProfile != nil { 315 objectMap["linuxProfile"] = p.LinuxProfile 316 } 317 if p.DiagnosticsProfile != nil { 318 objectMap["diagnosticsProfile"] = p.DiagnosticsProfile 319 } 320 return json.Marshal(objectMap) 321} 322 323// Resource the Resource model definition. 324type Resource struct { 325 // ID - READ-ONLY; Resource Id 326 ID *string `json:"id,omitempty"` 327 // Name - READ-ONLY; Resource name 328 Name *string `json:"name,omitempty"` 329 // Type - READ-ONLY; Resource type 330 Type *string `json:"type,omitempty"` 331 // Location - Resource location 332 Location *string `json:"location,omitempty"` 333 // Tags - Resource tags 334 Tags map[string]*string `json:"tags"` 335} 336 337// MarshalJSON is the custom marshaler for Resource. 338func (r Resource) MarshalJSON() ([]byte, error) { 339 objectMap := make(map[string]interface{}) 340 if r.Location != nil { 341 objectMap["location"] = r.Location 342 } 343 if r.Tags != nil { 344 objectMap["tags"] = r.Tags 345 } 346 return json.Marshal(objectMap) 347} 348 349// SSHConfiguration SSH configuration for Linux-based VMs running on Azure. 350type SSHConfiguration struct { 351 // PublicKeys - the list of SSH public keys used to authenticate with Linux-based VMs. 352 PublicKeys *[]SSHPublicKey `json:"publicKeys,omitempty"` 353} 354 355// SSHPublicKey contains information about SSH certificate public key data. 356type SSHPublicKey struct { 357 // KeyData - Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. 358 KeyData *string `json:"keyData,omitempty"` 359} 360 361// VMDiagnostics profile for diagnostics on the container service VMs. 362type VMDiagnostics struct { 363 // Enabled - Whether the VM diagnostic agent is provisioned on the VM. 364 Enabled *bool `json:"enabled,omitempty"` 365 // StorageURI - READ-ONLY; The URI of the storage account where diagnostics are stored. 366 StorageURI *string `json:"storageUri,omitempty"` 367} 368 369// MarshalJSON is the custom marshaler for VMDiagnostics. 370func (vd VMDiagnostics) MarshalJSON() ([]byte, error) { 371 objectMap := make(map[string]interface{}) 372 if vd.Enabled != nil { 373 objectMap["enabled"] = vd.Enabled 374 } 375 return json.Marshal(objectMap) 376} 377 378// WindowsProfile profile for Windows VMs in the container service cluster. 379type WindowsProfile struct { 380 // AdminUsername - The administrator username to use for Windows VMs 381 AdminUsername *string `json:"adminUsername,omitempty"` 382 // AdminPassword - The administrator password to use for Windows VMs 383 AdminPassword *string `json:"adminPassword,omitempty"` 384} 385