1package databricks
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	"context"
22	"encoding/json"
23	"github.com/Azure/go-autorest/autorest"
24	"github.com/Azure/go-autorest/autorest/azure"
25	"github.com/Azure/go-autorest/autorest/date"
26	"github.com/Azure/go-autorest/autorest/to"
27	"github.com/Azure/go-autorest/tracing"
28	"github.com/satori/go.uuid"
29	"net/http"
30)
31
32// The package's fully qualified name.
33const fqdn = "github.com/Azure/azure-sdk-for-go/services/databricks/mgmt/2018-04-01/databricks"
34
35// CustomParameterType enumerates the values for custom parameter type.
36type CustomParameterType string
37
38const (
39	// Bool ...
40	Bool CustomParameterType = "Bool"
41	// Object ...
42	Object CustomParameterType = "Object"
43	// String ...
44	String CustomParameterType = "String"
45)
46
47// PossibleCustomParameterTypeValues returns an array of possible values for the CustomParameterType const type.
48func PossibleCustomParameterTypeValues() []CustomParameterType {
49	return []CustomParameterType{Bool, Object, String}
50}
51
52// ProvisioningState enumerates the values for provisioning state.
53type ProvisioningState string
54
55const (
56	// Accepted ...
57	Accepted ProvisioningState = "Accepted"
58	// Canceled ...
59	Canceled ProvisioningState = "Canceled"
60	// Created ...
61	Created ProvisioningState = "Created"
62	// Creating ...
63	Creating ProvisioningState = "Creating"
64	// Deleted ...
65	Deleted ProvisioningState = "Deleted"
66	// Deleting ...
67	Deleting ProvisioningState = "Deleting"
68	// Failed ...
69	Failed ProvisioningState = "Failed"
70	// Ready ...
71	Ready ProvisioningState = "Ready"
72	// Running ...
73	Running ProvisioningState = "Running"
74	// Succeeded ...
75	Succeeded ProvisioningState = "Succeeded"
76	// Updating ...
77	Updating ProvisioningState = "Updating"
78)
79
80// PossibleProvisioningStateValues returns an array of possible values for the ProvisioningState const type.
81func PossibleProvisioningStateValues() []ProvisioningState {
82	return []ProvisioningState{Accepted, Canceled, Created, Creating, Deleted, Deleting, Failed, Ready, Running, Succeeded, Updating}
83}
84
85// CreatedBy provides details of the entity that created/updated the workspace.
86type CreatedBy struct {
87	// Oid - READ-ONLY; The Object ID that created the workspace.
88	Oid *uuid.UUID `json:"oid,omitempty"`
89	// Puid - READ-ONLY; The Personal Object ID corresponding to the object ID above
90	Puid *string `json:"puid,omitempty"`
91	// ApplicationID - READ-ONLY; The application ID of the application that initiated the creation of the workspace. For example, Azure Portal.
92	ApplicationID *uuid.UUID `json:"applicationId,omitempty"`
93}
94
95// ErrorDetail ...
96type ErrorDetail struct {
97	// Code - The error's code.
98	Code *string `json:"code,omitempty"`
99	// Message - A human readable error message.
100	Message *string `json:"message,omitempty"`
101	// Target - Indicates which property in the request is responsible for the error.
102	Target *string `json:"target,omitempty"`
103}
104
105// ErrorInfo ...
106type ErrorInfo struct {
107	// Code - A machine readable error code.
108	Code *string `json:"code,omitempty"`
109	// Message - A human readable error message.
110	Message *string `json:"message,omitempty"`
111	// Details - error details.
112	Details *[]ErrorDetail `json:"details,omitempty"`
113	// Innererror - Inner error details if they exist.
114	Innererror *string `json:"innererror,omitempty"`
115}
116
117// ErrorResponse contains details when the response code indicates an error.
118type ErrorResponse struct {
119	// Error - The error details.
120	Error *ErrorInfo `json:"error,omitempty"`
121}
122
123// Operation REST API operation
124type Operation struct {
125	// Name - Operation name: {provider}/{resource}/{operation}
126	Name *string `json:"name,omitempty"`
127	// Display - The object that represents the operation.
128	Display *OperationDisplay `json:"display,omitempty"`
129}
130
131// OperationDisplay the object that represents the operation.
132type OperationDisplay struct {
133	// Provider - Service provider: Microsoft.ResourceProvider
134	Provider *string `json:"provider,omitempty"`
135	// Resource - Resource on which the operation is performed.
136	Resource *string `json:"resource,omitempty"`
137	// Operation - Operation type: Read, write, delete, etc.
138	Operation *string `json:"operation,omitempty"`
139}
140
141// OperationListResult result of the request to list Resource Provider operations. It contains a list of
142// operations and a URL link to get the next set of results.
143type OperationListResult struct {
144	autorest.Response `json:"-"`
145	// Value - List of Resource Provider operations supported by the Resource Provider resource provider.
146	Value *[]Operation `json:"value,omitempty"`
147	// NextLink - URL to get the next set of operation list results if there are any.
148	NextLink *string `json:"nextLink,omitempty"`
149}
150
151// OperationListResultIterator provides access to a complete listing of Operation values.
152type OperationListResultIterator struct {
153	i    int
154	page OperationListResultPage
155}
156
157// NextWithContext advances to the next value.  If there was an error making
158// the request the iterator does not advance and the error is returned.
159func (iter *OperationListResultIterator) NextWithContext(ctx context.Context) (err error) {
160	if tracing.IsEnabled() {
161		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultIterator.NextWithContext")
162		defer func() {
163			sc := -1
164			if iter.Response().Response.Response != nil {
165				sc = iter.Response().Response.Response.StatusCode
166			}
167			tracing.EndSpan(ctx, sc, err)
168		}()
169	}
170	iter.i++
171	if iter.i < len(iter.page.Values()) {
172		return nil
173	}
174	err = iter.page.NextWithContext(ctx)
175	if err != nil {
176		iter.i--
177		return err
178	}
179	iter.i = 0
180	return nil
181}
182
183// Next advances to the next value.  If there was an error making
184// the request the iterator does not advance and the error is returned.
185// Deprecated: Use NextWithContext() instead.
186func (iter *OperationListResultIterator) Next() error {
187	return iter.NextWithContext(context.Background())
188}
189
190// NotDone returns true if the enumeration should be started or is not yet complete.
191func (iter OperationListResultIterator) NotDone() bool {
192	return iter.page.NotDone() && iter.i < len(iter.page.Values())
193}
194
195// Response returns the raw server response from the last page request.
196func (iter OperationListResultIterator) Response() OperationListResult {
197	return iter.page.Response()
198}
199
200// Value returns the current value or a zero-initialized value if the
201// iterator has advanced beyond the end of the collection.
202func (iter OperationListResultIterator) Value() Operation {
203	if !iter.page.NotDone() {
204		return Operation{}
205	}
206	return iter.page.Values()[iter.i]
207}
208
209// Creates a new instance of the OperationListResultIterator type.
210func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator {
211	return OperationListResultIterator{page: page}
212}
213
214// IsEmpty returns true if the ListResult contains no values.
215func (olr OperationListResult) IsEmpty() bool {
216	return olr.Value == nil || len(*olr.Value) == 0
217}
218
219// operationListResultPreparer prepares a request to retrieve the next set of results.
220// It returns nil if no more results exist.
221func (olr OperationListResult) operationListResultPreparer(ctx context.Context) (*http.Request, error) {
222	if olr.NextLink == nil || len(to.String(olr.NextLink)) < 1 {
223		return nil, nil
224	}
225	return autorest.Prepare((&http.Request{}).WithContext(ctx),
226		autorest.AsJSON(),
227		autorest.AsGet(),
228		autorest.WithBaseURL(to.String(olr.NextLink)))
229}
230
231// OperationListResultPage contains a page of Operation values.
232type OperationListResultPage struct {
233	fn  func(context.Context, OperationListResult) (OperationListResult, error)
234	olr OperationListResult
235}
236
237// NextWithContext advances to the next page of values.  If there was an error making
238// the request the page does not advance and the error is returned.
239func (page *OperationListResultPage) NextWithContext(ctx context.Context) (err error) {
240	if tracing.IsEnabled() {
241		ctx = tracing.StartSpan(ctx, fqdn+"/OperationListResultPage.NextWithContext")
242		defer func() {
243			sc := -1
244			if page.Response().Response.Response != nil {
245				sc = page.Response().Response.Response.StatusCode
246			}
247			tracing.EndSpan(ctx, sc, err)
248		}()
249	}
250	next, err := page.fn(ctx, page.olr)
251	if err != nil {
252		return err
253	}
254	page.olr = next
255	return nil
256}
257
258// Next advances to the next page of values.  If there was an error making
259// the request the page does not advance and the error is returned.
260// Deprecated: Use NextWithContext() instead.
261func (page *OperationListResultPage) Next() error {
262	return page.NextWithContext(context.Background())
263}
264
265// NotDone returns true if the page enumeration should be started or is not yet complete.
266func (page OperationListResultPage) NotDone() bool {
267	return !page.olr.IsEmpty()
268}
269
270// Response returns the raw server response from the last page request.
271func (page OperationListResultPage) Response() OperationListResult {
272	return page.olr
273}
274
275// Values returns the slice of values for the current page or nil if there are no values.
276func (page OperationListResultPage) Values() []Operation {
277	if page.olr.IsEmpty() {
278		return nil
279	}
280	return *page.olr.Value
281}
282
283// Creates a new instance of the OperationListResultPage type.
284func NewOperationListResultPage(getNextPage func(context.Context, OperationListResult) (OperationListResult, error)) OperationListResultPage {
285	return OperationListResultPage{fn: getNextPage}
286}
287
288// Resource the core properties of ARM resources
289type Resource struct {
290	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
291	ID *string `json:"id,omitempty"`
292	// Name - READ-ONLY; The name of the resource
293	Name *string `json:"name,omitempty"`
294	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
295	Type *string `json:"type,omitempty"`
296}
297
298// Sku SKU for the resource.
299type Sku struct {
300	// Name - The SKU name.
301	Name *string `json:"name,omitempty"`
302	// Tier - The SKU tier.
303	Tier *string `json:"tier,omitempty"`
304}
305
306// TrackedResource the resource model definition for a ARM tracked top level resource
307type TrackedResource struct {
308	// Tags - Resource tags.
309	Tags map[string]*string `json:"tags"`
310	// Location - The geo-location where the resource lives
311	Location *string `json:"location,omitempty"`
312	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
313	ID *string `json:"id,omitempty"`
314	// Name - READ-ONLY; The name of the resource
315	Name *string `json:"name,omitempty"`
316	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
317	Type *string `json:"type,omitempty"`
318}
319
320// MarshalJSON is the custom marshaler for TrackedResource.
321func (tr TrackedResource) MarshalJSON() ([]byte, error) {
322	objectMap := make(map[string]interface{})
323	if tr.Tags != nil {
324		objectMap["tags"] = tr.Tags
325	}
326	if tr.Location != nil {
327		objectMap["location"] = tr.Location
328	}
329	return json.Marshal(objectMap)
330}
331
332// Workspace information about workspace.
333type Workspace struct {
334	autorest.Response `json:"-"`
335	// WorkspaceProperties - The workspace properties.
336	*WorkspaceProperties `json:"properties,omitempty"`
337	// Sku - The SKU of the resource.
338	Sku *Sku `json:"sku,omitempty"`
339	// Tags - Resource tags.
340	Tags map[string]*string `json:"tags"`
341	// Location - The geo-location where the resource lives
342	Location *string `json:"location,omitempty"`
343	// ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}
344	ID *string `json:"id,omitempty"`
345	// Name - READ-ONLY; The name of the resource
346	Name *string `json:"name,omitempty"`
347	// Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts.
348	Type *string `json:"type,omitempty"`
349}
350
351// MarshalJSON is the custom marshaler for Workspace.
352func (w Workspace) MarshalJSON() ([]byte, error) {
353	objectMap := make(map[string]interface{})
354	if w.WorkspaceProperties != nil {
355		objectMap["properties"] = w.WorkspaceProperties
356	}
357	if w.Sku != nil {
358		objectMap["sku"] = w.Sku
359	}
360	if w.Tags != nil {
361		objectMap["tags"] = w.Tags
362	}
363	if w.Location != nil {
364		objectMap["location"] = w.Location
365	}
366	return json.Marshal(objectMap)
367}
368
369// UnmarshalJSON is the custom unmarshaler for Workspace struct.
370func (w *Workspace) UnmarshalJSON(body []byte) error {
371	var m map[string]*json.RawMessage
372	err := json.Unmarshal(body, &m)
373	if err != nil {
374		return err
375	}
376	for k, v := range m {
377		switch k {
378		case "properties":
379			if v != nil {
380				var workspaceProperties WorkspaceProperties
381				err = json.Unmarshal(*v, &workspaceProperties)
382				if err != nil {
383					return err
384				}
385				w.WorkspaceProperties = &workspaceProperties
386			}
387		case "sku":
388			if v != nil {
389				var sku Sku
390				err = json.Unmarshal(*v, &sku)
391				if err != nil {
392					return err
393				}
394				w.Sku = &sku
395			}
396		case "tags":
397			if v != nil {
398				var tags map[string]*string
399				err = json.Unmarshal(*v, &tags)
400				if err != nil {
401					return err
402				}
403				w.Tags = tags
404			}
405		case "location":
406			if v != nil {
407				var location string
408				err = json.Unmarshal(*v, &location)
409				if err != nil {
410					return err
411				}
412				w.Location = &location
413			}
414		case "id":
415			if v != nil {
416				var ID string
417				err = json.Unmarshal(*v, &ID)
418				if err != nil {
419					return err
420				}
421				w.ID = &ID
422			}
423		case "name":
424			if v != nil {
425				var name string
426				err = json.Unmarshal(*v, &name)
427				if err != nil {
428					return err
429				}
430				w.Name = &name
431			}
432		case "type":
433			if v != nil {
434				var typeVar string
435				err = json.Unmarshal(*v, &typeVar)
436				if err != nil {
437					return err
438				}
439				w.Type = &typeVar
440			}
441		}
442	}
443
444	return nil
445}
446
447// WorkspaceCustomBooleanParameter the value which should be used for this field.
448type WorkspaceCustomBooleanParameter struct {
449	// Type - The type of variable that this is. Possible values include: 'Bool', 'Object', 'String'
450	Type CustomParameterType `json:"type,omitempty"`
451	// Value - The value which should be used for this field.
452	Value *bool `json:"value,omitempty"`
453}
454
455// WorkspaceCustomObjectParameter the value which should be used for this field.
456type WorkspaceCustomObjectParameter struct {
457	// Type - The type of variable that this is. Possible values include: 'Bool', 'Object', 'String'
458	Type CustomParameterType `json:"type,omitempty"`
459	// Value - The value which should be used for this field.
460	Value interface{} `json:"value,omitempty"`
461}
462
463// WorkspaceCustomParameters custom Parameters used for Cluster Creation.
464type WorkspaceCustomParameters struct {
465	// CustomVirtualNetworkID - The ID of a Virtual Network where this Databricks Cluster should be created
466	CustomVirtualNetworkID *WorkspaceCustomStringParameter `json:"customVirtualNetworkId,omitempty"`
467	// CustomPublicSubnetName - The name of a Public Subnet within the Virtual Network
468	CustomPublicSubnetName *WorkspaceCustomStringParameter `json:"customPublicSubnetName,omitempty"`
469	// CustomPrivateSubnetName - The name of the Private Subnet within the Virtual Network
470	CustomPrivateSubnetName *WorkspaceCustomStringParameter `json:"customPrivateSubnetName,omitempty"`
471	// EnableNoPublicIP - Should the Public IP be Disabled?
472	EnableNoPublicIP *WorkspaceCustomBooleanParameter `json:"enableNoPublicIp,omitempty"`
473}
474
475// WorkspaceCustomStringParameter the Value.
476type WorkspaceCustomStringParameter struct {
477	// Type - The type of variable that this is. Possible values include: 'Bool', 'Object', 'String'
478	Type CustomParameterType `json:"type,omitempty"`
479	// Value - The value which should be used for this field.
480	Value *string `json:"value,omitempty"`
481}
482
483// WorkspaceListResult list of workspaces.
484type WorkspaceListResult struct {
485	autorest.Response `json:"-"`
486	// Value - The array of workspaces.
487	Value *[]Workspace `json:"value,omitempty"`
488	// NextLink - The URL to use for getting the next set of results.
489	NextLink *string `json:"nextLink,omitempty"`
490}
491
492// WorkspaceListResultIterator provides access to a complete listing of Workspace values.
493type WorkspaceListResultIterator struct {
494	i    int
495	page WorkspaceListResultPage
496}
497
498// NextWithContext advances to the next value.  If there was an error making
499// the request the iterator does not advance and the error is returned.
500func (iter *WorkspaceListResultIterator) NextWithContext(ctx context.Context) (err error) {
501	if tracing.IsEnabled() {
502		ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultIterator.NextWithContext")
503		defer func() {
504			sc := -1
505			if iter.Response().Response.Response != nil {
506				sc = iter.Response().Response.Response.StatusCode
507			}
508			tracing.EndSpan(ctx, sc, err)
509		}()
510	}
511	iter.i++
512	if iter.i < len(iter.page.Values()) {
513		return nil
514	}
515	err = iter.page.NextWithContext(ctx)
516	if err != nil {
517		iter.i--
518		return err
519	}
520	iter.i = 0
521	return nil
522}
523
524// Next advances to the next value.  If there was an error making
525// the request the iterator does not advance and the error is returned.
526// Deprecated: Use NextWithContext() instead.
527func (iter *WorkspaceListResultIterator) Next() error {
528	return iter.NextWithContext(context.Background())
529}
530
531// NotDone returns true if the enumeration should be started or is not yet complete.
532func (iter WorkspaceListResultIterator) NotDone() bool {
533	return iter.page.NotDone() && iter.i < len(iter.page.Values())
534}
535
536// Response returns the raw server response from the last page request.
537func (iter WorkspaceListResultIterator) Response() WorkspaceListResult {
538	return iter.page.Response()
539}
540
541// Value returns the current value or a zero-initialized value if the
542// iterator has advanced beyond the end of the collection.
543func (iter WorkspaceListResultIterator) Value() Workspace {
544	if !iter.page.NotDone() {
545		return Workspace{}
546	}
547	return iter.page.Values()[iter.i]
548}
549
550// Creates a new instance of the WorkspaceListResultIterator type.
551func NewWorkspaceListResultIterator(page WorkspaceListResultPage) WorkspaceListResultIterator {
552	return WorkspaceListResultIterator{page: page}
553}
554
555// IsEmpty returns true if the ListResult contains no values.
556func (wlr WorkspaceListResult) IsEmpty() bool {
557	return wlr.Value == nil || len(*wlr.Value) == 0
558}
559
560// workspaceListResultPreparer prepares a request to retrieve the next set of results.
561// It returns nil if no more results exist.
562func (wlr WorkspaceListResult) workspaceListResultPreparer(ctx context.Context) (*http.Request, error) {
563	if wlr.NextLink == nil || len(to.String(wlr.NextLink)) < 1 {
564		return nil, nil
565	}
566	return autorest.Prepare((&http.Request{}).WithContext(ctx),
567		autorest.AsJSON(),
568		autorest.AsGet(),
569		autorest.WithBaseURL(to.String(wlr.NextLink)))
570}
571
572// WorkspaceListResultPage contains a page of Workspace values.
573type WorkspaceListResultPage struct {
574	fn  func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)
575	wlr WorkspaceListResult
576}
577
578// NextWithContext advances to the next page of values.  If there was an error making
579// the request the page does not advance and the error is returned.
580func (page *WorkspaceListResultPage) NextWithContext(ctx context.Context) (err error) {
581	if tracing.IsEnabled() {
582		ctx = tracing.StartSpan(ctx, fqdn+"/WorkspaceListResultPage.NextWithContext")
583		defer func() {
584			sc := -1
585			if page.Response().Response.Response != nil {
586				sc = page.Response().Response.Response.StatusCode
587			}
588			tracing.EndSpan(ctx, sc, err)
589		}()
590	}
591	next, err := page.fn(ctx, page.wlr)
592	if err != nil {
593		return err
594	}
595	page.wlr = next
596	return nil
597}
598
599// Next advances to the next page of values.  If there was an error making
600// the request the page does not advance and the error is returned.
601// Deprecated: Use NextWithContext() instead.
602func (page *WorkspaceListResultPage) Next() error {
603	return page.NextWithContext(context.Background())
604}
605
606// NotDone returns true if the page enumeration should be started or is not yet complete.
607func (page WorkspaceListResultPage) NotDone() bool {
608	return !page.wlr.IsEmpty()
609}
610
611// Response returns the raw server response from the last page request.
612func (page WorkspaceListResultPage) Response() WorkspaceListResult {
613	return page.wlr
614}
615
616// Values returns the slice of values for the current page or nil if there are no values.
617func (page WorkspaceListResultPage) Values() []Workspace {
618	if page.wlr.IsEmpty() {
619		return nil
620	}
621	return *page.wlr.Value
622}
623
624// Creates a new instance of the WorkspaceListResultPage type.
625func NewWorkspaceListResultPage(getNextPage func(context.Context, WorkspaceListResult) (WorkspaceListResult, error)) WorkspaceListResultPage {
626	return WorkspaceListResultPage{fn: getNextPage}
627}
628
629// WorkspaceProperties the workspace properties.
630type WorkspaceProperties struct {
631	// ManagedResourceGroupID - The managed resource group Id.
632	ManagedResourceGroupID *string `json:"managedResourceGroupId,omitempty"`
633	// Parameters - The workspace's custom parameters.
634	Parameters *WorkspaceCustomParameters `json:"parameters,omitempty"`
635	// ProvisioningState - READ-ONLY; The workspace provisioning state. Possible values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating'
636	ProvisioningState ProvisioningState `json:"provisioningState,omitempty"`
637	// UIDefinitionURI - The blob URI where the UI definition file is located.
638	UIDefinitionURI *string `json:"uiDefinitionUri,omitempty"`
639	// Authorizations - The workspace provider authorizations.
640	Authorizations *[]WorkspaceProviderAuthorization `json:"authorizations,omitempty"`
641	// CreatedBy - Indicates the Object ID, PUID and Application ID of entity that created the workspace.
642	CreatedBy *CreatedBy `json:"createdBy,omitempty"`
643	// UpdatedBy - Indicates the Object ID, PUID and Application ID of entity that last updated the workspace.
644	UpdatedBy *CreatedBy `json:"updatedBy,omitempty"`
645	// CreatedDateTime - Specifies the date and time when the workspace is created.
646	CreatedDateTime *date.Time `json:"createdDateTime,omitempty"`
647	// WorkspaceID - READ-ONLY; The unique identifier of the databricks workspace in databricks control plane.
648	WorkspaceID *string `json:"workspaceId,omitempty"`
649	// WorkspaceURL - READ-ONLY; The workspace URL which is of the format 'adb-{workspaceId}.{random}.azuredatabricks.net'
650	WorkspaceURL *string `json:"workspaceUrl,omitempty"`
651}
652
653// WorkspaceProviderAuthorization the workspace provider authorization.
654type WorkspaceProviderAuthorization struct {
655	// PrincipalID - The provider's principal identifier. This is the identity that the provider will use to call ARM to manage the workspace resources.
656	PrincipalID *uuid.UUID `json:"principalId,omitempty"`
657	// RoleDefinitionID - The provider's role definition identifier. This role will define all the permissions that the provider must have on the workspace's container resource group. This role definition cannot have permission to delete the resource group.
658	RoleDefinitionID *uuid.UUID `json:"roleDefinitionId,omitempty"`
659}
660
661// WorkspacesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a
662// long-running operation.
663type WorkspacesCreateOrUpdateFuture struct {
664	azure.Future
665}
666
667// Result returns the result of the asynchronous operation.
668// If the operation has not completed it will return an error.
669func (future *WorkspacesCreateOrUpdateFuture) Result(client WorkspacesClient) (w Workspace, err error) {
670	var done bool
671	done, err = future.DoneWithContext(context.Background(), client)
672	if err != nil {
673		err = autorest.NewErrorWithError(err, "databricks.WorkspacesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure")
674		return
675	}
676	if !done {
677		err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesCreateOrUpdateFuture")
678		return
679	}
680	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
681	if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent {
682		w, err = client.CreateOrUpdateResponder(w.Response.Response)
683		if err != nil {
684			err = autorest.NewErrorWithError(err, "databricks.WorkspacesCreateOrUpdateFuture", "Result", w.Response.Response, "Failure responding to request")
685		}
686	}
687	return
688}
689
690// WorkspacesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running
691// operation.
692type WorkspacesDeleteFuture struct {
693	azure.Future
694}
695
696// Result returns the result of the asynchronous operation.
697// If the operation has not completed it will return an error.
698func (future *WorkspacesDeleteFuture) Result(client WorkspacesClient) (ar autorest.Response, err error) {
699	var done bool
700	done, err = future.DoneWithContext(context.Background(), client)
701	if err != nil {
702		err = autorest.NewErrorWithError(err, "databricks.WorkspacesDeleteFuture", "Result", future.Response(), "Polling failure")
703		return
704	}
705	if !done {
706		err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesDeleteFuture")
707		return
708	}
709	ar.Response = future.Response()
710	return
711}
712
713// WorkspacesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running
714// operation.
715type WorkspacesUpdateFuture struct {
716	azure.Future
717}
718
719// Result returns the result of the asynchronous operation.
720// If the operation has not completed it will return an error.
721func (future *WorkspacesUpdateFuture) Result(client WorkspacesClient) (w Workspace, err error) {
722	var done bool
723	done, err = future.DoneWithContext(context.Background(), client)
724	if err != nil {
725		err = autorest.NewErrorWithError(err, "databricks.WorkspacesUpdateFuture", "Result", future.Response(), "Polling failure")
726		return
727	}
728	if !done {
729		err = azure.NewAsyncOpIncompleteError("databricks.WorkspacesUpdateFuture")
730		return
731	}
732	sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
733	if w.Response.Response, err = future.GetResult(sender); err == nil && w.Response.Response.StatusCode != http.StatusNoContent {
734		w, err = client.UpdateResponder(w.Response.Response)
735		if err != nil {
736			err = autorest.NewErrorWithError(err, "databricks.WorkspacesUpdateFuture", "Result", w.Response.Response, "Failure responding to request")
737		}
738	}
739	return
740}
741
742// WorkspaceUpdate an update to a workspace.
743type WorkspaceUpdate struct {
744	// Tags - Resource tags.
745	Tags map[string]*string `json:"tags"`
746}
747
748// MarshalJSON is the custom marshaler for WorkspaceUpdate.
749func (wu WorkspaceUpdate) MarshalJSON() ([]byte, error) {
750	objectMap := make(map[string]interface{})
751	if wu.Tags != nil {
752		objectMap["tags"] = wu.Tags
753	}
754	return json.Marshal(objectMap)
755}
756