From d1de5a863af2bd340afbfa0b1a8320e0e25f412a Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Thu, 24 Oct 2019 22:28:00 +0000 Subject: [PATCH 1/2] Generated from 7dcde316dc95ae117ec71fdbfee6c8d52c7197a0 Remove ReplicaSet Nested Resource --- .../domainservices/mgmt/aad/aadapi/models.go | 1 - .../latest/domainservices/mgmt/aad/models.go | 21 - .../domainservices/mgmt/aad/aadapi/models.go | 1 - .../preview/domainservices/mgmt/aad/models.go | 21 - .../mgmt/2017-01-01/aad/domainservices.go | 5 +- .../mgmt/2017-01-01/aad/models.go | 40 +- .../mgmt/2017-06-01/aad/aadapi/interfaces.go | 11 - .../mgmt/2017-06-01/aad/domainservices.go | 5 +- .../mgmt/2017-06-01/aad/models.go | 410 +------------- .../mgmt/2017-06-01/aad/replicasets.go | 526 ------------------ 10 files changed, 56 insertions(+), 985 deletions(-) delete mode 100644 services/domainservices/mgmt/2017-06-01/aad/replicasets.go diff --git a/profiles/latest/domainservices/mgmt/aad/aadapi/models.go b/profiles/latest/domainservices/mgmt/aad/aadapi/models.go index 57ce54cbf838..9f299cf3ee98 100644 --- a/profiles/latest/domainservices/mgmt/aad/aadapi/models.go +++ b/profiles/latest/domainservices/mgmt/aad/aadapi/models.go @@ -23,4 +23,3 @@ import original "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/ type DomainServiceOperationsClientAPI = original.DomainServiceOperationsClientAPI type DomainServicesClientAPI = original.DomainServicesClientAPI -type ReplicaSetsClientAPI = original.ReplicaSetsClientAPI diff --git a/profiles/latest/domainservices/mgmt/aad/models.go b/profiles/latest/domainservices/mgmt/aad/models.go index 0f420e987f44..d204eceb8de3 100644 --- a/profiles/latest/domainservices/mgmt/aad/models.go +++ b/profiles/latest/domainservices/mgmt/aad/models.go @@ -106,15 +106,6 @@ type OperationEntity = original.OperationEntity type OperationEntityListResult = original.OperationEntityListResult type OperationEntityListResultIterator = original.OperationEntityListResultIterator type OperationEntityListResultPage = original.OperationEntityListResultPage -type ReplicaSet = original.ReplicaSet -type ReplicaSetListResult = original.ReplicaSetListResult -type ReplicaSetListResultIterator = original.ReplicaSetListResultIterator -type ReplicaSetListResultPage = original.ReplicaSetListResultPage -type ReplicaSetProperties = original.ReplicaSetProperties -type ReplicaSetsClient = original.ReplicaSetsClient -type ReplicaSetsCreateOrUpdateFuture = original.ReplicaSetsCreateOrUpdateFuture -type ReplicaSetsDeleteFuture = original.ReplicaSetsDeleteFuture -type ReplicaSetsUpdateFuture = original.ReplicaSetsUpdateFuture type Resource = original.Resource func New(subscriptionID string) BaseClient { @@ -144,18 +135,6 @@ func NewOperationEntityListResultIterator(page OperationEntityListResultPage) Op func NewOperationEntityListResultPage(getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { return original.NewOperationEntityListResultPage(getNextPage) } -func NewReplicaSetListResultIterator(page ReplicaSetListResultPage) ReplicaSetListResultIterator { - return original.NewReplicaSetListResultIterator(page) -} -func NewReplicaSetListResultPage(getNextPage func(context.Context, ReplicaSetListResult) (ReplicaSetListResult, error)) ReplicaSetListResultPage { - return original.NewReplicaSetListResultPage(getNextPage) -} -func NewReplicaSetsClient(subscriptionID string) ReplicaSetsClient { - return original.NewReplicaSetsClient(subscriptionID) -} -func NewReplicaSetsClientWithBaseURI(baseURI string, subscriptionID string) ReplicaSetsClient { - return original.NewReplicaSetsClientWithBaseURI(baseURI, subscriptionID) -} func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } diff --git a/profiles/preview/domainservices/mgmt/aad/aadapi/models.go b/profiles/preview/domainservices/mgmt/aad/aadapi/models.go index 57ce54cbf838..9f299cf3ee98 100644 --- a/profiles/preview/domainservices/mgmt/aad/aadapi/models.go +++ b/profiles/preview/domainservices/mgmt/aad/aadapi/models.go @@ -23,4 +23,3 @@ import original "github.com/Azure/azure-sdk-for-go/services/domainservices/mgmt/ type DomainServiceOperationsClientAPI = original.DomainServiceOperationsClientAPI type DomainServicesClientAPI = original.DomainServicesClientAPI -type ReplicaSetsClientAPI = original.ReplicaSetsClientAPI diff --git a/profiles/preview/domainservices/mgmt/aad/models.go b/profiles/preview/domainservices/mgmt/aad/models.go index f44817d14213..1988a4bf6b03 100644 --- a/profiles/preview/domainservices/mgmt/aad/models.go +++ b/profiles/preview/domainservices/mgmt/aad/models.go @@ -106,15 +106,6 @@ type OperationEntity = original.OperationEntity type OperationEntityListResult = original.OperationEntityListResult type OperationEntityListResultIterator = original.OperationEntityListResultIterator type OperationEntityListResultPage = original.OperationEntityListResultPage -type ReplicaSet = original.ReplicaSet -type ReplicaSetListResult = original.ReplicaSetListResult -type ReplicaSetListResultIterator = original.ReplicaSetListResultIterator -type ReplicaSetListResultPage = original.ReplicaSetListResultPage -type ReplicaSetProperties = original.ReplicaSetProperties -type ReplicaSetsClient = original.ReplicaSetsClient -type ReplicaSetsCreateOrUpdateFuture = original.ReplicaSetsCreateOrUpdateFuture -type ReplicaSetsDeleteFuture = original.ReplicaSetsDeleteFuture -type ReplicaSetsUpdateFuture = original.ReplicaSetsUpdateFuture type Resource = original.Resource func New(subscriptionID string) BaseClient { @@ -144,18 +135,6 @@ func NewOperationEntityListResultIterator(page OperationEntityListResultPage) Op func NewOperationEntityListResultPage(getNextPage func(context.Context, OperationEntityListResult) (OperationEntityListResult, error)) OperationEntityListResultPage { return original.NewOperationEntityListResultPage(getNextPage) } -func NewReplicaSetListResultIterator(page ReplicaSetListResultPage) ReplicaSetListResultIterator { - return original.NewReplicaSetListResultIterator(page) -} -func NewReplicaSetListResultPage(getNextPage func(context.Context, ReplicaSetListResult) (ReplicaSetListResult, error)) ReplicaSetListResultPage { - return original.NewReplicaSetListResultPage(getNextPage) -} -func NewReplicaSetsClient(subscriptionID string) ReplicaSetsClient { - return original.NewReplicaSetsClient(subscriptionID) -} -func NewReplicaSetsClientWithBaseURI(baseURI string, subscriptionID string) ReplicaSetsClient { - return original.NewReplicaSetsClientWithBaseURI(baseURI, subscriptionID) -} func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return original.NewWithBaseURI(baseURI, subscriptionID) } diff --git a/services/domainservices/mgmt/2017-01-01/aad/domainservices.go b/services/domainservices/mgmt/2017-01-01/aad/domainservices.go index dadaae920a30..3b19e52aad80 100644 --- a/services/domainservices/mgmt/2017-01-01/aad/domainservices.go +++ b/services/domainservices/mgmt/2017-01-01/aad/domainservices.go @@ -207,14 +207,13 @@ func (client DomainServicesClient) DeleteSender(req *http.Request) (future Domai // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client DomainServicesClient) DeleteResponder(resp *http.Response) (result DomainService, err error) { +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.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } diff --git a/services/domainservices/mgmt/2017-01-01/aad/models.go b/services/domainservices/mgmt/2017-01-01/aad/models.go index 48023da54fae..15638a108dd3 100644 --- a/services/domainservices/mgmt/2017-01-01/aad/models.go +++ b/services/domainservices/mgmt/2017-01-01/aad/models.go @@ -166,11 +166,11 @@ type DomainService struct { autorest.Response `json:"-"` // DomainServiceProperties - Domain service properties *DomainServiceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id + // ID - Resource Id ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name + // Name - Resource name Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type + // Type - Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -186,6 +186,15 @@ func (ds DomainService) MarshalJSON() ([]byte, error) { 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 } @@ -491,7 +500,7 @@ type DomainServicesDeleteFuture struct { // 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) (ds DomainService, err 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 { @@ -502,13 +511,7 @@ func (future *DomainServicesDeleteFuture) Result(client DomainServicesClient) (d err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture") 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.DeleteResponder(ds.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", ds.Response.Response, "Failure responding to request") - } - } + ar.Response = future.Response() return } @@ -769,11 +772,11 @@ func NewOperationEntityListResultPage(getNextPage func(context.Context, Operatio // Resource the Resource model definition. type Resource struct { - // ID - READ-ONLY; Resource Id + // ID - Resource Id ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name + // Name - Resource name Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type + // Type - Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -786,6 +789,15 @@ type Resource struct { // 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 } diff --git a/services/domainservices/mgmt/2017-06-01/aad/aadapi/interfaces.go b/services/domainservices/mgmt/2017-06-01/aad/aadapi/interfaces.go index 196cfd7a44ed..2fa637e9d9a0 100644 --- a/services/domainservices/mgmt/2017-06-01/aad/aadapi/interfaces.go +++ b/services/domainservices/mgmt/2017-06-01/aad/aadapi/interfaces.go @@ -40,14 +40,3 @@ type DomainServicesClientAPI interface { } var _ DomainServicesClientAPI = (*aad.DomainServicesClient)(nil) - -// ReplicaSetsClientAPI contains the set of methods on the ReplicaSetsClient type. -type ReplicaSetsClientAPI interface { - CreateOrUpdate(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string, replicaSet aad.ReplicaSet) (result aad.ReplicaSetsCreateOrUpdateFuture, err error) - Delete(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string) (result aad.ReplicaSetsDeleteFuture, err error) - Get(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string) (result aad.ReplicaSet, err error) - ListByResourceGroup(ctx context.Context, resourceGroupName string, domainServiceName string) (result aad.ReplicaSetListResultPage, err error) - Update(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string, replicaSet aad.ReplicaSet) (result aad.ReplicaSetsUpdateFuture, err error) -} - -var _ ReplicaSetsClientAPI = (*aad.ReplicaSetsClient)(nil) diff --git a/services/domainservices/mgmt/2017-06-01/aad/domainservices.go b/services/domainservices/mgmt/2017-06-01/aad/domainservices.go index 0587bb6f3ced..9c4e3fc68441 100644 --- a/services/domainservices/mgmt/2017-06-01/aad/domainservices.go +++ b/services/domainservices/mgmt/2017-06-01/aad/domainservices.go @@ -207,14 +207,13 @@ func (client DomainServicesClient) DeleteSender(req *http.Request) (future Domai // DeleteResponder handles the response to the Delete request. The method always // closes the http.Response Body. -func (client DomainServicesClient) DeleteResponder(resp *http.Response) (result DomainService, err error) { +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.ByUnmarshallingJSON(&result), autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} + result.Response = resp return } diff --git a/services/domainservices/mgmt/2017-06-01/aad/models.go b/services/domainservices/mgmt/2017-06-01/aad/models.go index 35ec375aaa13..de6ea403886b 100644 --- a/services/domainservices/mgmt/2017-06-01/aad/models.go +++ b/services/domainservices/mgmt/2017-06-01/aad/models.go @@ -166,11 +166,11 @@ type DomainService struct { autorest.Response `json:"-"` // DomainServiceProperties - Domain service properties *DomainServiceProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id + // ID - Resource Id ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name + // Name - Resource name Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type + // Type - Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -186,6 +186,15 @@ func (ds DomainService) MarshalJSON() ([]byte, error) { 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 } @@ -491,7 +500,7 @@ type DomainServicesDeleteFuture struct { // 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) (ds DomainService, err 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 { @@ -502,13 +511,7 @@ func (future *DomainServicesDeleteFuture) Result(client DomainServicesClient) (d err = azure.NewAsyncOpIncompleteError("aad.DomainServicesDeleteFuture") 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.DeleteResponder(ds.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.DomainServicesDeleteFuture", "Result", ds.Response.Response, "Failure responding to request") - } - } + ar.Response = future.Response() return } @@ -767,383 +770,13 @@ func NewOperationEntityListResultPage(getNextPage func(context.Context, Operatio return OperationEntityListResultPage{fn: getNextPage} } -// ReplicaSet replica Set. -type ReplicaSet struct { - autorest.Response `json:"-"` - // ReplicaSetProperties - ReplicaSet properties - *ReplicaSetProperties `json:"properties,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; 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 ReplicaSet. -func (rs ReplicaSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if rs.ReplicaSetProperties != nil { - objectMap["properties"] = rs.ReplicaSetProperties - } - if rs.Location != nil { - objectMap["location"] = rs.Location - } - if rs.Tags != nil { - objectMap["tags"] = rs.Tags - } - if rs.Etag != nil { - objectMap["etag"] = rs.Etag - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for ReplicaSet struct. -func (rs *ReplicaSet) 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 replicaSetProperties ReplicaSetProperties - err = json.Unmarshal(*v, &replicaSetProperties) - if err != nil { - return err - } - rs.ReplicaSetProperties = &replicaSetProperties - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - rs.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - rs.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - rs.Type = &typeVar - } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - rs.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - rs.Tags = tags - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - rs.Etag = &etag - } - } - } - - return nil -} - -// ReplicaSetListResult the response from the List ReplicaSets operation. -type ReplicaSetListResult struct { - autorest.Response `json:"-"` - // Value - the list of ReplicaSet. - Value *[]ReplicaSet `json:"value,omitempty"` - // NextLink - READ-ONLY; The continuation token for the next page of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// ReplicaSetListResultIterator provides access to a complete listing of ReplicaSet values. -type ReplicaSetListResultIterator struct { - i int - page ReplicaSetListResultPage -} - -// 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 *ReplicaSetListResultIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetListResultIterator.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 *ReplicaSetListResultIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter ReplicaSetListResultIterator) 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 ReplicaSetListResultIterator) Response() ReplicaSetListResult { - 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 ReplicaSetListResultIterator) Value() ReplicaSet { - if !iter.page.NotDone() { - return ReplicaSet{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the ReplicaSetListResultIterator type. -func NewReplicaSetListResultIterator(page ReplicaSetListResultPage) ReplicaSetListResultIterator { - return ReplicaSetListResultIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (rslr ReplicaSetListResult) IsEmpty() bool { - return rslr.Value == nil || len(*rslr.Value) == 0 -} - -// replicaSetListResultPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (rslr ReplicaSetListResult) replicaSetListResultPreparer(ctx context.Context) (*http.Request, error) { - if rslr.NextLink == nil || len(to.String(rslr.NextLink)) < 1 { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(rslr.NextLink))) -} - -// ReplicaSetListResultPage contains a page of ReplicaSet values. -type ReplicaSetListResultPage struct { - fn func(context.Context, ReplicaSetListResult) (ReplicaSetListResult, error) - rslr ReplicaSetListResult -} - -// 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 *ReplicaSetListResultPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetListResultPage.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.rslr) - if err != nil { - return err - } - page.rslr = 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 *ReplicaSetListResultPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page ReplicaSetListResultPage) NotDone() bool { - return !page.rslr.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page ReplicaSetListResultPage) Response() ReplicaSetListResult { - return page.rslr -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page ReplicaSetListResultPage) Values() []ReplicaSet { - if page.rslr.IsEmpty() { - return nil - } - return *page.rslr.Value -} - -// Creates a new instance of the ReplicaSetListResultPage type. -func NewReplicaSetListResultPage(getNextPage func(context.Context, ReplicaSetListResult) (ReplicaSetListResult, error)) ReplicaSetListResultPage { - return ReplicaSetListResultPage{fn: getNextPage} -} - -// ReplicaSetProperties properties of the ReplicaSet. -type ReplicaSetProperties struct { - // ReplicaSetID - READ-ONLY; ReplicaSet Id - ReplicaSetID *string `json:"replicaSetId,omitempty"` - // SubnetID - The name of the virtual network that ReplicaSets will be deployed on. /virtualNetwork/vnetName/subnets/subnetName. - SubnetID *string `json:"subnetId,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"` - // 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"` - // ExternalAccessIPAddress - READ-ONLY; External access ip address. - ExternalAccessIPAddress *string `json:"externalAccessIpAddress,omitempty"` -} - -// ReplicaSetsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type ReplicaSetsCreateOrUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ReplicaSetsCreateOrUpdateFuture) Result(client ReplicaSetsClient) (rs ReplicaSet, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("aad.ReplicaSetsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rs.Response.Response, err = future.GetResult(sender); err == nil && rs.Response.Response.StatusCode != http.StatusNoContent { - rs, err = client.CreateOrUpdateResponder(rs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsCreateOrUpdateFuture", "Result", rs.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicaSetsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicaSetsDeleteFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ReplicaSetsDeleteFuture) Result(client ReplicaSetsClient) (rs ReplicaSet, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("aad.ReplicaSetsDeleteFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rs.Response.Response, err = future.GetResult(sender); err == nil && rs.Response.Response.StatusCode != http.StatusNoContent { - rs, err = client.DeleteResponder(rs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsDeleteFuture", "Result", rs.Response.Response, "Failure responding to request") - } - } - return -} - -// ReplicaSetsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type ReplicaSetsUpdateFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *ReplicaSetsUpdateFuture) Result(client ReplicaSetsClient) (rs ReplicaSet, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("aad.ReplicaSetsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if rs.Response.Response, err = future.GetResult(sender); err == nil && rs.Response.Response.StatusCode != http.StatusNoContent { - rs, err = client.UpdateResponder(rs.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsUpdateFuture", "Result", rs.Response.Response, "Failure responding to request") - } - } - return -} - // Resource the Resource model definition. type Resource struct { - // ID - READ-ONLY; Resource Id + // ID - Resource Id ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name + // Name - Resource name Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type + // Type - Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -1156,6 +789,15 @@ type Resource struct { // 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 } diff --git a/services/domainservices/mgmt/2017-06-01/aad/replicasets.go b/services/domainservices/mgmt/2017-06-01/aad/replicasets.go deleted file mode 100644 index 9e2b7b2a1074..000000000000 --- a/services/domainservices/mgmt/2017-06-01/aad/replicasets.go +++ /dev/null @@ -1,526 +0,0 @@ -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" -) - -// ReplicaSetsClient is the the AAD Domain Services API. -type ReplicaSetsClient struct { - BaseClient -} - -// NewReplicaSetsClient creates an instance of the ReplicaSetsClient client. -func NewReplicaSetsClient(subscriptionID string) ReplicaSetsClient { - return NewReplicaSetsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewReplicaSetsClientWithBaseURI creates an instance of the ReplicaSetsClient client. -func NewReplicaSetsClientWithBaseURI(baseURI string, subscriptionID string) ReplicaSetsClient { - return ReplicaSetsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate the Create ReplicaSet operation creates a new domain service with the specified parameters. -// 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. -// replicaSetName - the name of the replica set. -// replicaSet - properties supplied to the Create ReplicaSet operation. -func (client ReplicaSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string, replicaSet ReplicaSet) (result ReplicaSetsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetsClient.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.ReplicaSetsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, domainServiceName, replicaSetName, replicaSet) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client ReplicaSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string, replicaSet ReplicaSet) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "replicaSetName": autorest.Encode("path", replicaSetName), - "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}/replicaSets/{replicaSetName}", pathParameters), - autorest.WithJSON(replicaSet), - 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 ReplicaSetsClient) CreateOrUpdateSender(req *http.Request) (future ReplicaSetsCreateOrUpdateFuture, 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 ReplicaSetsClient) CreateOrUpdateResponder(resp *http.Response) (result ReplicaSet, 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 ReplicaSet operation deletes an existing ReplicaSet. -// 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. -// replicaSetName - the name of the replica set. -func (client ReplicaSetsClient) Delete(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string) (result ReplicaSetsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetsClient.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.ReplicaSetsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, domainServiceName, replicaSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ReplicaSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "replicaSetName": autorest.Encode("path", replicaSetName), - "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}/replicaSets/{replicaSetName}", 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 ReplicaSetsClient) DeleteSender(req *http.Request) (future ReplicaSetsDeleteFuture, 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 ReplicaSetsClient) DeleteResponder(resp *http.Response) (result ReplicaSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get the Get ReplicaSet operation retrieves a json representation of the ReplicaSet. -// 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. -// replicaSetName - the name of the replica set. -func (client ReplicaSetsClient) Get(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string) (result ReplicaSet, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetsClient.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.ReplicaSetsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, domainServiceName, replicaSetName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "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.ReplicaSetsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ReplicaSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "replicaSetName": autorest.Encode("path", replicaSetName), - "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}/replicaSets/{replicaSetName}", 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 ReplicaSetsClient) 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 ReplicaSetsClient) GetResponder(resp *http.Response) (result ReplicaSet, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByResourceGroup the List ReplicaSets 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. -// domainServiceName - the name of the domain service. -func (client ReplicaSetsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, domainServiceName string) (result ReplicaSetListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetsClient.ListByResourceGroup") - defer func() { - sc := -1 - if result.rslr.Response.Response != nil { - sc = result.rslr.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.ReplicaSetsClient", "ListByResourceGroup", err.Error()) - } - - result.fn = client.listByResourceGroupNextResults - req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, domainServiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "ListByResourceGroup", nil, "Failure preparing request") - return - } - - resp, err := client.ListByResourceGroupSender(req) - if err != nil { - result.rslr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "ListByResourceGroup", resp, "Failure sending request") - return - } - - result.rslr, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "ListByResourceGroup", resp, "Failure responding to request") - } - - return -} - -// ListByResourceGroupPreparer prepares the ListByResourceGroup request. -func (client ReplicaSetsClient) ListByResourceGroupPreparer(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}/replicaSets", 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 ReplicaSetsClient) 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 ReplicaSetsClient) ListByResourceGroupResponder(resp *http.Response) (result ReplicaSetListResult, 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 ReplicaSetsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ReplicaSetListResult) (result ReplicaSetListResult, err error) { - req, err := lastResults.replicaSetListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "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.ReplicaSetsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByResourceGroupResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. -func (client ReplicaSetsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, domainServiceName string) (result ReplicaSetListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetsClient.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, domainServiceName) - return -} - -// Update the Update ReplicaSet 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. -// replicaSetName - the name of the replica set. -// replicaSet - properties supplied to the Update a ReplicaSet operation. -func (client ReplicaSetsClient) Update(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string, replicaSet ReplicaSet) (result ReplicaSetsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ReplicaSetsClient.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.ReplicaSetsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, domainServiceName, replicaSetName, replicaSet) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "aad.ReplicaSetsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client ReplicaSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, domainServiceName string, replicaSetName string, replicaSet ReplicaSet) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "domainServiceName": autorest.Encode("path", domainServiceName), - "replicaSetName": autorest.Encode("path", replicaSetName), - "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}/replicaSets/{replicaSetName}", pathParameters), - autorest.WithJSON(replicaSet), - 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 ReplicaSetsClient) UpdateSender(req *http.Request) (future ReplicaSetsUpdateFuture, 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 ReplicaSetsClient) UpdateResponder(resp *http.Response) (result ReplicaSet, 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 -} From fb6953cde2993a46887717543625bd7a50bc3596 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot Date: Mon, 28 Oct 2019 19:12:00 +0000 Subject: [PATCH 2/2] Generated from a7ad4520230d029f214826fb7ca1f442e6c95e8e Fix readyonly properties --- .../mgmt/2017-01-01/aad/models.go | 30 ++++--------------- .../mgmt/2017-06-01/aad/models.go | 30 ++++--------------- 2 files changed, 12 insertions(+), 48 deletions(-) diff --git a/services/domainservices/mgmt/2017-01-01/aad/models.go b/services/domainservices/mgmt/2017-01-01/aad/models.go index 15638a108dd3..e50192f57fb4 100644 --- a/services/domainservices/mgmt/2017-01-01/aad/models.go +++ b/services/domainservices/mgmt/2017-01-01/aad/models.go @@ -166,11 +166,11 @@ type DomainService struct { autorest.Response `json:"-"` // DomainServiceProperties - Domain service properties *DomainServiceProperties `json:"properties,omitempty"` - // ID - Resource Id + // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` - // Name - Resource name + // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` - // Type - Resource type + // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -186,15 +186,6 @@ func (ds DomainService) MarshalJSON() ([]byte, error) { 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 } @@ -772,11 +763,11 @@ func NewOperationEntityListResultPage(getNextPage func(context.Context, Operatio // Resource the Resource model definition. type Resource struct { - // ID - Resource Id + // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` - // Name - Resource name + // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` - // Type - Resource type + // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -789,15 +780,6 @@ type Resource struct { // 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 } diff --git a/services/domainservices/mgmt/2017-06-01/aad/models.go b/services/domainservices/mgmt/2017-06-01/aad/models.go index de6ea403886b..16b51ed456d1 100644 --- a/services/domainservices/mgmt/2017-06-01/aad/models.go +++ b/services/domainservices/mgmt/2017-06-01/aad/models.go @@ -166,11 +166,11 @@ type DomainService struct { autorest.Response `json:"-"` // DomainServiceProperties - Domain service properties *DomainServiceProperties `json:"properties,omitempty"` - // ID - Resource Id + // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` - // Name - Resource name + // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` - // Type - Resource type + // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -186,15 +186,6 @@ func (ds DomainService) MarshalJSON() ([]byte, error) { 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 } @@ -772,11 +763,11 @@ func NewOperationEntityListResultPage(getNextPage func(context.Context, Operatio // Resource the Resource model definition. type Resource struct { - // ID - Resource Id + // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` - // Name - Resource name + // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` - // Type - Resource type + // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` // Location - Resource location Location *string `json:"location,omitempty"` @@ -789,15 +780,6 @@ type Resource struct { // 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 }