diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/CHANGELOG.md b/services/domainservices/mgmt/2017-06-01/aad/v2/CHANGELOG.md new file mode 100644 index 000000000000..22897ca93ac3 --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/CHANGELOG.md @@ -0,0 +1,72 @@ +## Breaking Changes + +### Removed Funcs + +1. *ReplicaSet.UnmarshalJSON([]byte) error +1. *ReplicaSetListResultIterator.Next() error +1. *ReplicaSetListResultIterator.NextWithContext(context.Context) error +1. *ReplicaSetListResultPage.Next() error +1. *ReplicaSetListResultPage.NextWithContext(context.Context) error +1. *ReplicaSetsCreateOrUpdateFuture.Result(ReplicaSetsClient) (ReplicaSet,error) +1. *ReplicaSetsDeleteFuture.Result(ReplicaSetsClient) (ReplicaSet,error) +1. *ReplicaSetsUpdateFuture.Result(ReplicaSetsClient) (ReplicaSet,error) +1. NewReplicaSetListResultIterator(ReplicaSetListResultPage) ReplicaSetListResultIterator +1. NewReplicaSetListResultPage(func(context.Context, ReplicaSetListResult) (ReplicaSetListResult, error)) ReplicaSetListResultPage +1. NewReplicaSetsClient(string) ReplicaSetsClient +1. NewReplicaSetsClientWithBaseURI(string,string) ReplicaSetsClient +1. ReplicaSet.MarshalJSON() ([]byte,error) +1. ReplicaSetListResult.IsEmpty() bool +1. ReplicaSetListResultIterator.NotDone() bool +1. ReplicaSetListResultIterator.Response() ReplicaSetListResult +1. ReplicaSetListResultIterator.Value() ReplicaSet +1. ReplicaSetListResultPage.NotDone() bool +1. ReplicaSetListResultPage.Response() ReplicaSetListResult +1. ReplicaSetListResultPage.Values() []ReplicaSet +1. ReplicaSetsClient.CreateOrUpdate(context.Context,string,string,string,ReplicaSet) (ReplicaSetsCreateOrUpdateFuture,error) +1. ReplicaSetsClient.CreateOrUpdatePreparer(context.Context,string,string,string,ReplicaSet) (*http.Request,error) +1. ReplicaSetsClient.CreateOrUpdateResponder(*http.Response) (ReplicaSet,error) +1. ReplicaSetsClient.CreateOrUpdateSender(*http.Request) (ReplicaSetsCreateOrUpdateFuture,error) +1. ReplicaSetsClient.Delete(context.Context,string,string,string) (ReplicaSetsDeleteFuture,error) +1. ReplicaSetsClient.DeletePreparer(context.Context,string,string,string) (*http.Request,error) +1. ReplicaSetsClient.DeleteResponder(*http.Response) (ReplicaSet,error) +1. ReplicaSetsClient.DeleteSender(*http.Request) (ReplicaSetsDeleteFuture,error) +1. ReplicaSetsClient.Get(context.Context,string,string,string) (ReplicaSet,error) +1. ReplicaSetsClient.GetPreparer(context.Context,string,string,string) (*http.Request,error) +1. ReplicaSetsClient.GetResponder(*http.Response) (ReplicaSet,error) +1. ReplicaSetsClient.GetSender(*http.Request) (*http.Response,error) +1. ReplicaSetsClient.ListByResourceGroup(context.Context,string,string) (ReplicaSetListResultPage,error) +1. ReplicaSetsClient.ListByResourceGroupComplete(context.Context,string,string) (ReplicaSetListResultIterator,error) +1. ReplicaSetsClient.ListByResourceGroupPreparer(context.Context,string,string) (*http.Request,error) +1. ReplicaSetsClient.ListByResourceGroupResponder(*http.Response) (ReplicaSetListResult,error) +1. ReplicaSetsClient.ListByResourceGroupSender(*http.Request) (*http.Response,error) +1. ReplicaSetsClient.Update(context.Context,string,string,string,ReplicaSet) (ReplicaSetsUpdateFuture,error) +1. ReplicaSetsClient.UpdatePreparer(context.Context,string,string,string,ReplicaSet) (*http.Request,error) +1. ReplicaSetsClient.UpdateResponder(*http.Response) (ReplicaSet,error) +1. ReplicaSetsClient.UpdateSender(*http.Request) (ReplicaSetsUpdateFuture,error) + +## Struct Changes + +### Removed Structs + +1. ReplicaSet +1. ReplicaSetListResult +1. ReplicaSetListResultIterator +1. ReplicaSetListResultPage +1. ReplicaSetProperties +1. ReplicaSetsClient +1. ReplicaSetsCreateOrUpdateFuture +1. ReplicaSetsDeleteFuture +1. ReplicaSetsUpdateFuture + +## Signature Changes + +### Funcs + +1. *DomainServicesDeleteFuture.Result + - Returns + - From: DomainService,error + - To: autorest.Response,error +1. DomainServicesClient.DeleteResponder + - Returns + - From: DomainService,error + - To: autorest.Response,error diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/aadapi/interfaces.go b/services/domainservices/mgmt/2017-06-01/aad/v2/aadapi/interfaces.go new file mode 100644 index 000000000000..744503ba01ff --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/aadapi/interfaces.go @@ -0,0 +1,42 @@ +package aadapi + +// 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 ( + "context" + "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2017-06-01/aad/v2" +) + +// DomainServiceOperationsClientAPI contains the set of methods on the DomainServiceOperationsClient type. +type DomainServiceOperationsClientAPI interface { + List(ctx context.Context) (result aad.OperationEntityListResultPage, err error) +} + +var _ DomainServiceOperationsClientAPI = (*aad.DomainServiceOperationsClient)(nil) + +// DomainServicesClientAPI contains the set of methods on the DomainServicesClient type. +type DomainServicesClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, domainServiceName string, domainService aad.DomainService) (result aad.DomainServicesCreateOrUpdateFuture, err error) + Delete(ctx context.Context, resourceGroupName string, domainServiceName string) (result aad.DomainServicesDeleteFuture, err error) + Get(ctx context.Context, resourceGroupName string, domainServiceName string) (result aad.DomainService, err error) + List(ctx context.Context) (result aad.DomainServiceListResultPage, err error) + ListByResourceGroup(ctx context.Context, resourceGroupName string) (result aad.DomainServiceListResultPage, err error) + Update(ctx context.Context, resourceGroupName string, domainServiceName string, domainService aad.DomainService) (result aad.DomainServicesUpdateFuture, err error) +} + +var _ DomainServicesClientAPI = (*aad.DomainServicesClient)(nil) diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/client.go b/services/domainservices/mgmt/2017-06-01/aad/v2/client.go new file mode 100644 index 000000000000..875442063134 --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/client.go @@ -0,0 +1,51 @@ +// Package aad implements the Azure ARM Aad service API version 2017-06-01. +// +// The AAD Domain Services API. +package aad + +// 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 ( + "github.com/Azure/go-autorest/autorest" +) + +const ( + // DefaultBaseURI is the default URI used for the service Aad + DefaultBaseURI = "https://management.azure.com" +) + +// BaseClient is the base client for Aad. +type BaseClient struct { + autorest.Client + BaseURI string + SubscriptionID string +} + +// New creates an instance of the BaseClient client. +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWithBaseURI creates an instance of the BaseClient client. +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { + return BaseClient{ + Client: autorest.NewClientWithUserAgent(UserAgent()), + BaseURI: baseURI, + SubscriptionID: subscriptionID, + } +} diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/domainserviceoperations.go b/services/domainservices/mgmt/2017-06-01/aad/v2/domainserviceoperations.go new file mode 100644 index 000000000000..a79f5eb7536f --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/domainserviceoperations.go @@ -0,0 +1,147 @@ +package aad + +// 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainServiceOperationsClient is the the AAD Domain Services API. +type DomainServiceOperationsClient struct { + BaseClient +} + +// NewDomainServiceOperationsClient creates an instance of the DomainServiceOperationsClient client. +func NewDomainServiceOperationsClient(subscriptionID string) DomainServiceOperationsClient { + return NewDomainServiceOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainServiceOperationsClientWithBaseURI creates an instance of the DomainServiceOperationsClient client. +func NewDomainServiceOperationsClientWithBaseURI(baseURI string, subscriptionID string) DomainServiceOperationsClient { + return DomainServiceOperationsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists all the available Domain Services operations. +func (client DomainServiceOperationsClient) List(ctx context.Context) (result OperationEntityListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceOperationsClient.List") + defer func() { + sc := -1 + if result.oelr.Response.Response != nil { + sc = result.oelr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.oelr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", resp, "Failure sending request") + return + } + + result.oelr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DomainServiceOperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.AAD/operations"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServiceOperationsClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DomainServiceOperationsClient) ListResponder(resp *http.Response) (result OperationEntityListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DomainServiceOperationsClient) listNextResults(ctx context.Context, lastResults OperationEntityListResult) (result OperationEntityListResult, err error) { + req, err := lastResults.operationEntityListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServiceOperationsClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainServiceOperationsClient) ListComplete(ctx context.Context) (result OperationEntityListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceOperationsClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/domainservices.go b/services/domainservices/mgmt/2017-06-01/aad/v2/domainservices.go new file mode 100644 index 000000000000..9c4e3fc68441 --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/domainservices.go @@ -0,0 +1,628 @@ +package aad + +// 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 ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// DomainServicesClient is the the AAD Domain Services API. +type DomainServicesClient struct { + BaseClient +} + +// NewDomainServicesClient creates an instance of the DomainServicesClient client. +func NewDomainServicesClient(subscriptionID string) DomainServicesClient { + return NewDomainServicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewDomainServicesClientWithBaseURI creates an instance of the DomainServicesClient client. +func NewDomainServicesClientWithBaseURI(baseURI string, subscriptionID string) DomainServicesClient { + return DomainServicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate the Create Domain Service operation creates a new domain service with the specified parameters. If +// the specific service already exists, then any patchable properties will be updated and any immutable properties will +// remain unchanged. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// domainServiceName - the name of the domain service. +// domainService - properties supplied to the Create or Update a Domain Service operation. +func (client DomainServicesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (result DomainServicesCreateOrUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("aad.DomainServicesClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainServiceName, domainService) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = client.CreateOrUpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "CreateOrUpdate", result.Response(), "Failure sending request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client DomainServicesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainServiceName": autorest.Encode("path", domainServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), + autorest.WithJSON(domainService), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServicesClient) CreateOrUpdateSender(req *http.Request) (future DomainServicesCreateOrUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client DomainServicesClient) CreateOrUpdateResponder(resp *http.Response) (result DomainService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete the Delete Domain Service operation deletes an existing Domain Service. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// domainServiceName - the name of the domain service. +func (client DomainServicesClient) Delete(ctx context.Context, resourceGroupName string, domainServiceName string) (result DomainServicesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("aad.DomainServicesClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, domainServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = client.DeleteSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Delete", result.Response(), "Failure sending request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client DomainServicesClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainServiceName": autorest.Encode("path", domainServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServicesClient) DeleteSender(req *http.Request) (future DomainServicesDeleteFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client DomainServicesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get the Get Domain Service operation retrieves a json representation of the Domain Service. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// domainServiceName - the name of the domain service. +func (client DomainServicesClient) Get(ctx context.Context, resourceGroupName string, domainServiceName string) (result DomainService, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("aad.DomainServicesClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, domainServiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client DomainServicesClient) GetPreparer(ctx context.Context, resourceGroupName string, domainServiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainServiceName": autorest.Encode("path", domainServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetSender sends the Get request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServicesClient) GetSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client DomainServicesClient) GetResponder(resp *http.Response) (result DomainService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List the List Domain Services in Subscription operation lists all the domain services available under the given +// subscription (and across all resource groups within that subscription). +func (client DomainServicesClient) List(ctx context.Context) (result DomainServiceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.List") + defer func() { + sc := -1 + if result.dslr.Response.Response != nil { + sc = result.dslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.dslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", resp, "Failure sending request") + return + } + + result.dslr, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client DomainServicesClient) ListPreparer(ctx context.Context) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.AAD/domainServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServicesClient) ListSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client DomainServicesClient) ListResponder(resp *http.Response) (result DomainServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client DomainServicesClient) listNextResults(ctx context.Context, lastResults DomainServiceListResult) (result DomainServiceListResult, err error) { + req, err := lastResults.domainServiceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainServicesClient) ListComplete(ctx context.Context) (result DomainServiceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.List(ctx) + return +} + +// ListByResourceGroup the List Domain Services in Resource Group operation lists all the domain services available +// under the given resource group. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +func (client DomainServicesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result DomainServiceListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.dslr.Response.Response != nil { + sc = result.dslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("aad.DomainServicesClient", "ListByResourceGroup", err.Error()) + } + + result.fn = client.listByResourceGroupNextResults + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.dslr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result.dslr, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client DomainServicesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServicesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + return autorest.SendWithSender(client, req, sd...) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client DomainServicesClient) ListByResourceGroupResponder(resp *http.Response) (result DomainServiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByResourceGroupNextResults retrieves the next set of results, if any. +func (client DomainServicesClient) listByResourceGroupNextResults(ctx context.Context, lastResults DomainServiceListResult) (result DomainServiceListResult, err error) { + req, err := lastResults.domainServiceListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. +func (client DomainServicesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result DomainServiceListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) + return +} + +// Update the Update Domain Service operation can be used to update the existing deployment. The update call only +// supports the properties listed in the PATCH body. +// Parameters: +// resourceGroupName - the name of the resource group within the user's subscription. The name is case +// insensitive. +// domainServiceName - the name of the domain service. +// domainService - properties supplied to the Update a Domain Service operation. +func (client DomainServicesClient) Update(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (result DomainServicesUpdateFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServicesClient.Update") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: resourceGroupName, + Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, + {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + return result, validation.NewError("aad.DomainServicesClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, domainServiceName, domainService) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = client.UpdateSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesClient", "Update", result.Response(), "Failure sending request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client DomainServicesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, domainService DomainService) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "domainServiceName": autorest.Encode("path", domainServiceName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2017-06-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AAD/domainServices/{domainServiceName}", pathParameters), + autorest.WithJSON(domainService), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateSender sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (client DomainServicesClient) UpdateSender(req *http.Request) (future DomainServicesUpdateFuture, err error) { + sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, sd...) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client DomainServicesClient) UpdateResponder(resp *http.Response) (result DomainService, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/go.mod b/services/domainservices/mgmt/2017-06-01/aad/v2/go.mod new file mode 100644 index 000000000000..c64843397aa4 --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/go.mod @@ -0,0 +1,3 @@ +module github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2017-06-01/aad/v2 + +go 1.12 diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/models.go b/services/domainservices/mgmt/2017-06-01/aad/v2/models.go new file mode 100644 index 000000000000..de6ea403886b --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/models.go @@ -0,0 +1,811 @@ +package aad + +// 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 ( + "context" + "encoding/json" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" + "net/http" +) + +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/2017-06-01/aad" + +// ExternalAccess enumerates the values for external access. +type ExternalAccess string + +const ( + // Disabled ... + Disabled ExternalAccess = "Disabled" + // Enabled ... + Enabled ExternalAccess = "Enabled" +) + +// PossibleExternalAccessValues returns an array of possible values for the ExternalAccess const type. +func PossibleExternalAccessValues() []ExternalAccess { + return []ExternalAccess{Disabled, Enabled} +} + +// FilteredSync enumerates the values for filtered sync. +type FilteredSync string + +const ( + // FilteredSyncDisabled ... + FilteredSyncDisabled FilteredSync = "Disabled" + // FilteredSyncEnabled ... + FilteredSyncEnabled FilteredSync = "Enabled" +) + +// PossibleFilteredSyncValues returns an array of possible values for the FilteredSync const type. +func PossibleFilteredSyncValues() []FilteredSync { + return []FilteredSync{FilteredSyncDisabled, FilteredSyncEnabled} +} + +// Ldaps enumerates the values for ldaps. +type Ldaps string + +const ( + // LdapsDisabled ... + LdapsDisabled Ldaps = "Disabled" + // LdapsEnabled ... + LdapsEnabled Ldaps = "Enabled" +) + +// PossibleLdapsValues returns an array of possible values for the Ldaps const type. +func PossibleLdapsValues() []Ldaps { + return []Ldaps{LdapsDisabled, LdapsEnabled} +} + +// NotifyDcAdmins enumerates the values for notify dc admins. +type NotifyDcAdmins string + +const ( + // NotifyDcAdminsDisabled ... + NotifyDcAdminsDisabled NotifyDcAdmins = "Disabled" + // NotifyDcAdminsEnabled ... + NotifyDcAdminsEnabled NotifyDcAdmins = "Enabled" +) + +// PossibleNotifyDcAdminsValues returns an array of possible values for the NotifyDcAdmins const type. +func PossibleNotifyDcAdminsValues() []NotifyDcAdmins { + return []NotifyDcAdmins{NotifyDcAdminsDisabled, NotifyDcAdminsEnabled} +} + +// NotifyGlobalAdmins enumerates the values for notify global admins. +type NotifyGlobalAdmins string + +const ( + // NotifyGlobalAdminsDisabled ... + NotifyGlobalAdminsDisabled NotifyGlobalAdmins = "Disabled" + // NotifyGlobalAdminsEnabled ... + NotifyGlobalAdminsEnabled NotifyGlobalAdmins = "Enabled" +) + +// PossibleNotifyGlobalAdminsValues returns an array of possible values for the NotifyGlobalAdmins const type. +func PossibleNotifyGlobalAdminsValues() []NotifyGlobalAdmins { + return []NotifyGlobalAdmins{NotifyGlobalAdminsDisabled, NotifyGlobalAdminsEnabled} +} + +// NtlmV1 enumerates the values for ntlm v1. +type NtlmV1 string + +const ( + // NtlmV1Disabled ... + NtlmV1Disabled NtlmV1 = "Disabled" + // NtlmV1Enabled ... + NtlmV1Enabled NtlmV1 = "Enabled" +) + +// PossibleNtlmV1Values returns an array of possible values for the NtlmV1 const type. +func PossibleNtlmV1Values() []NtlmV1 { + return []NtlmV1{NtlmV1Disabled, NtlmV1Enabled} +} + +// SyncNtlmPasswords enumerates the values for sync ntlm passwords. +type SyncNtlmPasswords string + +const ( + // SyncNtlmPasswordsDisabled ... + SyncNtlmPasswordsDisabled SyncNtlmPasswords = "Disabled" + // SyncNtlmPasswordsEnabled ... + SyncNtlmPasswordsEnabled SyncNtlmPasswords = "Enabled" +) + +// PossibleSyncNtlmPasswordsValues returns an array of possible values for the SyncNtlmPasswords const type. +func PossibleSyncNtlmPasswordsValues() []SyncNtlmPasswords { + return []SyncNtlmPasswords{SyncNtlmPasswordsDisabled, SyncNtlmPasswordsEnabled} +} + +// TLSV1 enumerates the values for tlsv1. +type TLSV1 string + +const ( + // TLSV1Disabled ... + TLSV1Disabled TLSV1 = "Disabled" + // TLSV1Enabled ... + TLSV1Enabled TLSV1 = "Enabled" +) + +// PossibleTLSV1Values returns an array of possible values for the TLSV1 const type. +func PossibleTLSV1Values() []TLSV1 { + return []TLSV1{TLSV1Disabled, TLSV1Enabled} +} + +// DomainSecuritySettings domain Security Settings +type DomainSecuritySettings struct { + // NtlmV1 - A flag to determine whether or not NtlmV1 is enabled or disabled. Possible values include: 'NtlmV1Enabled', 'NtlmV1Disabled' + NtlmV1 NtlmV1 `json:"ntlmV1,omitempty"` + // TLSV1 - A flag to determine whether or not TlsV1 is enabled or disabled. Possible values include: 'TLSV1Enabled', 'TLSV1Disabled' + TLSV1 TLSV1 `json:"tlsV1,omitempty"` + // SyncNtlmPasswords - A flag to determine whether or not SyncNtlmPasswords is enabled or disabled. Possible values include: 'SyncNtlmPasswordsEnabled', 'SyncNtlmPasswordsDisabled' + SyncNtlmPasswords SyncNtlmPasswords `json:"syncNtlmPasswords,omitempty"` +} + +// DomainService domain service. +type DomainService struct { + autorest.Response `json:"-"` + // DomainServiceProperties - Domain service properties + *DomainServiceProperties `json:"properties,omitempty"` + // 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 + Tags map[string]*string `json:"tags"` + // Etag - Resource etag + Etag *string `json:"etag,omitempty"` +} + +// MarshalJSON is the custom marshaler for DomainService. +func (ds DomainService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if ds.DomainServiceProperties != nil { + objectMap["properties"] = ds.DomainServiceProperties + } + if ds.ID != nil { + objectMap["id"] = ds.ID + } + if ds.Name != nil { + objectMap["name"] = ds.Name + } + if ds.Type != nil { + objectMap["type"] = ds.Type + } + if ds.Location != nil { + objectMap["location"] = ds.Location + } + if ds.Tags != nil { + objectMap["tags"] = ds.Tags + } + if ds.Etag != nil { + objectMap["etag"] = ds.Etag + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for DomainService struct. +func (ds *DomainService) 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 domainServiceProperties DomainServiceProperties + err = json.Unmarshal(*v, &domainServiceProperties) + if err != nil { + return err + } + ds.DomainServiceProperties = &domainServiceProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + ds.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + ds.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + ds.Type = &typeVar + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + ds.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + ds.Tags = tags + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + ds.Etag = &etag + } + } + } + + return nil +} + +// DomainServiceListResult the response from the List Domain Services operation. +type DomainServiceListResult struct { + autorest.Response `json:"-"` + // Value - the list of domain services. + Value *[]DomainService `json:"value,omitempty"` + // NextLink - READ-ONLY; The continuation token for the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// DomainServiceListResultIterator provides access to a complete listing of DomainService values. +type DomainServiceListResultIterator struct { + i int + page DomainServiceListResultPage +} + +// NextWithContext 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 *DomainServiceListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *DomainServiceListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter DomainServiceListResultIterator) 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 DomainServiceListResultIterator) Response() DomainServiceListResult { + 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 DomainServiceListResultIterator) Value() DomainService { + if !iter.page.NotDone() { + return DomainService{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the DomainServiceListResultIterator type. +func NewDomainServiceListResultIterator(page DomainServiceListResultPage) DomainServiceListResultIterator { + return DomainServiceListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (dslr DomainServiceListResult) IsEmpty() bool { + return dslr.Value == nil || len(*dslr.Value) == 0 +} + +// domainServiceListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (dslr DomainServiceListResult) domainServiceListResultPreparer(ctx context.Context) (*http.Request, error) { + if dslr.NextLink == nil || len(to.String(dslr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(dslr.NextLink))) +} + +// DomainServiceListResultPage contains a page of DomainService values. +type DomainServiceListResultPage struct { + fn func(context.Context, DomainServiceListResult) (DomainServiceListResult, error) + dslr DomainServiceListResult +} + +// NextWithContext 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 *DomainServiceListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DomainServiceListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.dslr) + if err != nil { + return err + } + page.dslr = next + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *DomainServiceListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page DomainServiceListResultPage) NotDone() bool { + return !page.dslr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page DomainServiceListResultPage) Response() DomainServiceListResult { + return page.dslr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page DomainServiceListResultPage) Values() []DomainService { + if page.dslr.IsEmpty() { + return nil + } + return *page.dslr.Value +} + +// Creates a new instance of the DomainServiceListResultPage type. +func NewDomainServiceListResultPage(getNextPage func(context.Context, DomainServiceListResult) (DomainServiceListResult, error)) DomainServiceListResultPage { + return DomainServiceListResultPage{fn: getNextPage} +} + +// DomainServiceProperties properties of the Domain Service. +type DomainServiceProperties struct { + // TenantID - READ-ONLY; Azure Active Directory tenant id + TenantID *string `json:"tenantId,omitempty"` + // DomainName - The name of the Azure domain that the user would like to deploy Domain Services to. + DomainName *string `json:"domainName,omitempty"` + // VnetSiteID - READ-ONLY; Virtual network site id + VnetSiteID *string `json:"vnetSiteId,omitempty"` + // SubnetID - The name of the virtual network that Domain Services will be deployed on. The id of the subnet that Domain Services will be deployed on. /virtualNetwork/vnetName/subnets/subnetName. + SubnetID *string `json:"subnetId,omitempty"` + // LdapsSettings - Secure LDAP Settings + LdapsSettings *LdapsSettings `json:"ldapsSettings,omitempty"` + // HealthLastEvaluated - READ-ONLY; Last domain evaluation run DateTime + HealthLastEvaluated *date.Time `json:"healthLastEvaluated,omitempty"` + // HealthMonitors - READ-ONLY; List of Domain Health Monitors + HealthMonitors *[]HealthMonitor `json:"healthMonitors,omitempty"` + // HealthAlerts - READ-ONLY; List of Domain Health Alerts + HealthAlerts *[]HealthAlert `json:"healthAlerts,omitempty"` + // NotificationSettings - Notification Settings + NotificationSettings *NotificationSettings `json:"notificationSettings,omitempty"` + // DomainSecuritySettings - DomainSecurity Settings + DomainSecuritySettings *DomainSecuritySettings `json:"domainSecuritySettings,omitempty"` + // FilteredSync - Enabled or Disabled flag to turn on Group-based filtered sync. Possible values include: 'FilteredSyncEnabled', 'FilteredSyncDisabled' + FilteredSync FilteredSync `json:"filteredSync,omitempty"` + // DomainControllerIPAddress - READ-ONLY; List of Domain Controller IP Address + DomainControllerIPAddress *[]string `json:"domainControllerIpAddress,omitempty"` + // ServiceStatus - READ-ONLY; Status of Domain Service instance + ServiceStatus *string `json:"serviceStatus,omitempty"` + // ProvisioningState - READ-ONLY; the current deployment or provisioning state, which only appears in the response. + ProvisioningState *string `json:"provisioningState,omitempty"` +} + +// DomainServicesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a +// long-running operation. +type DomainServicesCreateOrUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DomainServicesCreateOrUpdateFuture) Result(client DomainServicesClient) (ds DomainService, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("aad.DomainServicesCreateOrUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { + ds, err = client.CreateOrUpdateResponder(ds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesCreateOrUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") + } + } + return +} + +// DomainServicesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainServicesDeleteFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DomainServicesDeleteFuture) Result(client DomainServicesClient) (ar autorest.Response, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture") + return + } + ar.Response = future.Response() + return +} + +// DomainServicesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type DomainServicesUpdateFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *DomainServicesUpdateFuture) Result(client DomainServicesClient) (ds DomainService, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("aad.DomainServicesUpdateFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if ds.Response.Response, err = future.GetResult(sender); err == nil && ds.Response.Response.StatusCode != http.StatusNoContent { + ds, err = client.UpdateResponder(ds.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "aad.DomainServicesUpdateFuture", "Result", ds.Response.Response, "Failure responding to request") + } + } + return +} + +// HealthAlert health Alert Description +type HealthAlert struct { + // ID - READ-ONLY; Health Alert Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Health Alert Name + Name *string `json:"name,omitempty"` + // Issue - READ-ONLY; Health Alert Issue + Issue *string `json:"issue,omitempty"` + // Severity - READ-ONLY; Health Alert Severity + Severity *string `json:"severity,omitempty"` + // Raised - READ-ONLY; Health Alert Raised DateTime + Raised *date.Time `json:"raised,omitempty"` + // LastDetected - READ-ONLY; Health Alert Last Detected DateTime + LastDetected *date.Time `json:"lastDetected,omitempty"` + // ResolutionURI - READ-ONLY; Health Alert TSG Link + ResolutionURI *string `json:"resolutionUri,omitempty"` +} + +// HealthMonitor health Monitor Description +type HealthMonitor struct { + // ID - READ-ONLY; Health Monitor Id + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; Health Monitor Name + Name *string `json:"name,omitempty"` + // Details - READ-ONLY; Health Monitor Details + Details *string `json:"details,omitempty"` +} + +// LdapsSettings secure LDAP Settings +type LdapsSettings struct { + // Ldaps - A flag to determine whether or not Secure LDAP is enabled or disabled. Possible values include: 'LdapsEnabled', 'LdapsDisabled' + Ldaps Ldaps `json:"ldaps,omitempty"` + // PfxCertificate - The certificate required to configure Secure LDAP. The parameter passed here should be a base64encoded representation of the certificate pfx file. + PfxCertificate *string `json:"pfxCertificate,omitempty"` + // PfxCertificatePassword - The password to decrypt the provided Secure LDAP certificate pfx file. + PfxCertificatePassword *string `json:"pfxCertificatePassword,omitempty"` + // PublicCertificate - READ-ONLY; Public certificate used to configure secure ldap. + PublicCertificate *string `json:"publicCertificate,omitempty"` + // CertificateThumbprint - READ-ONLY; Thumbprint of configure ldaps certificate. + CertificateThumbprint *string `json:"certificateThumbprint,omitempty"` + // CertificateNotAfter - READ-ONLY; NotAfter DateTime of configure ldaps certificate. + CertificateNotAfter *date.Time `json:"certificateNotAfter,omitempty"` + // ExternalAccess - A flag to determine whether or not Secure LDAP access over the internet is enabled or disabled. Possible values include: 'Enabled', 'Disabled' + ExternalAccess ExternalAccess `json:"externalAccess,omitempty"` + // ExternalAccessIPAddress - READ-ONLY; External access ip address. + ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"` +} + +// NotificationSettings settings for notification +type NotificationSettings struct { + // NotifyGlobalAdmins - Should global admins be notified. Possible values include: 'NotifyGlobalAdminsEnabled', 'NotifyGlobalAdminsDisabled' + NotifyGlobalAdmins NotifyGlobalAdmins `json:"notifyGlobalAdmins,omitempty"` + // NotifyDcAdmins - Should domain controller admins be notified. Possible values include: 'NotifyDcAdminsEnabled', 'NotifyDcAdminsDisabled' + NotifyDcAdmins NotifyDcAdmins `json:"notifyDcAdmins,omitempty"` + // AdditionalRecipients - The list of additional recipients + AdditionalRecipients *[]string `json:"additionalRecipients,omitempty"` +} + +// OperationDisplayInfo the operation supported by Domain Services. +type OperationDisplayInfo struct { + // Description - The description of the operation. + Description *string `json:"description,omitempty"` + // Operation - The action that users can perform, based on their permission level. + Operation *string `json:"operation,omitempty"` + // Provider - Service provider: Domain Services. + Provider *string `json:"provider,omitempty"` + // Resource - Resource on which the operation is performed. + Resource *string `json:"resource,omitempty"` +} + +// OperationEntity the operation supported by Domain Services. +type OperationEntity struct { + // Name - Operation name: {provider}/{resource}/{operation}. + Name *string `json:"name,omitempty"` + // Display - The operation supported by Domain Services. + Display *OperationDisplayInfo `json:"display,omitempty"` + // Origin - The origin of the operation. + Origin *string `json:"origin,omitempty"` +} + +// OperationEntityListResult the list of domain service operation response. +type OperationEntityListResult struct { + autorest.Response `json:"-"` + // Value - The list of operations. + Value *[]OperationEntity `json:"value,omitempty"` + // NextLink - READ-ONLY; The continuation token for the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// OperationEntityListResultIterator provides access to a complete listing of OperationEntity values. +type OperationEntityListResultIterator struct { + i int + page OperationEntityListResultPage +} + +// NextWithContext 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 *OperationEntityListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + iter.i++ + if iter.i < len(iter.page.Values()) { + return nil + } + err = iter.page.NextWithContext(ctx) + if err != nil { + iter.i-- + return err + } + iter.i = 0 + return nil +} + +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *OperationEntityListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter OperationEntityListResultIterator) 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 OperationEntityListResultIterator) Response() OperationEntityListResult { + 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 OperationEntityListResultIterator) Value() OperationEntity { + if !iter.page.NotDone() { + return OperationEntity{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the OperationEntityListResultIterator type. +func NewOperationEntityListResultIterator(page OperationEntityListResultPage) OperationEntityListResultIterator { + return OperationEntityListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (oelr OperationEntityListResult) IsEmpty() bool { + return oelr.Value == nil || len(*oelr.Value) == 0 +} + +// operationEntityListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (oelr OperationEntityListResult) operationEntityListResultPreparer(ctx context.Context) (*http.Request, error) { + if oelr.NextLink == nil || len(to.String(oelr.NextLink)) < 1 { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(oelr.NextLink))) +} + +// OperationEntityListResultPage contains a page of OperationEntity values. +type OperationEntityListResultPage struct { + fn func(context.Context, OperationEntityListResult) (OperationEntityListResult, error) + oelr OperationEntityListResult +} + +// NextWithContext 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 *OperationEntityListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/OperationEntityListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.oelr) + if err != nil { + return err + } + page.oelr = next + return nil +} + +// 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. +// Deprecated: Use NextWithContext() instead. +func (page *OperationEntityListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page OperationEntityListResultPage) NotDone() bool { + return !page.oelr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page OperationEntityListResultPage) Response() OperationEntityListResult { + return page.oelr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page OperationEntityListResultPage) Values() []OperationEntity { + if page.oelr.IsEmpty() { + return nil + } + return *page.oelr.Value +} + +// Creates a new instance of the OperationEntityListResultPage type. +func NewOperationEntityListResultPage(getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { + return OperationEntityListResultPage{fn: getNextPage} +} + +// Resource the Resource model definition. +type Resource struct { + // 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 + Tags map[string]*string `json:"tags"` + // Etag - Resource etag + Etag *string `json:"etag,omitempty"` +} + +// 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 + } + if r.Etag != nil { + objectMap["etag"] = r.Etag + } + return json.Marshal(objectMap) +} diff --git a/services/domainservices/mgmt/2017-06-01/aad/v2/version.go b/services/domainservices/mgmt/2017-06-01/aad/v2/version.go new file mode 100644 index 000000000000..45a4a96086e3 --- /dev/null +++ b/services/domainservices/mgmt/2017-06-01/aad/v2/version.go @@ -0,0 +1,30 @@ +package aad + +// 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. + +// UserAgent returns the UserAgent string to use when sending http.Requests. +func UserAgent() string { + return "Azure-SDK-For-Go/2.0.0 aad/2017-06-01" +} + +// Version returns the semantic version (see http://semver.org) of the client. +func Version() string { + return "2.0.0" +} + +// tag: services/domainservices/mgmt/2017-06-01/aad/v2.0.0