diff --git a/services/automation/mgmt/2015-10-31/automation/CHANGELOG.md b/services/automation/mgmt/2015-10-31/automation/CHANGELOG.md index 52911e4cc5e4..ce1aeaeccd94 100644 --- a/services/automation/mgmt/2015-10-31/automation/CHANGELOG.md +++ b/services/automation/mgmt/2015-10-31/automation/CHANGELOG.md @@ -1,2 +1,75 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. *PrivateEndpointConnection.UnmarshalJSON([]byte) error +1. *Watcher.UnmarshalJSON([]byte) error +1. *WatcherListResultIterator.Next() error +1. *WatcherListResultIterator.NextWithContext(context.Context) error +1. *WatcherListResultPage.Next() error +1. *WatcherListResultPage.NextWithContext(context.Context) error +1. *WatcherUpdateParameters.UnmarshalJSON([]byte) error +1. NewWatcherClient(string) WatcherClient +1. NewWatcherClientWithBaseURI(string, string) WatcherClient +1. NewWatcherListResultIterator(WatcherListResultPage) WatcherListResultIterator +1. NewWatcherListResultPage(WatcherListResult, func(context.Context, WatcherListResult) (WatcherListResult, error)) WatcherListResultPage +1. PrivateEndpointConnection.MarshalJSON() ([]byte, error) +1. PrivateLinkServiceConnectionStateProperty.MarshalJSON() ([]byte, error) +1. Watcher.MarshalJSON() ([]byte, error) +1. WatcherClient.CreateOrUpdate(context.Context, string, string, string, Watcher) (Watcher, error) +1. WatcherClient.CreateOrUpdatePreparer(context.Context, string, string, string, Watcher) (*http.Request, error) +1. WatcherClient.CreateOrUpdateResponder(*http.Response) (Watcher, error) +1. WatcherClient.CreateOrUpdateSender(*http.Request) (*http.Response, error) +1. WatcherClient.Delete(context.Context, string, string, string) (autorest.Response, error) +1. WatcherClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. WatcherClient.DeleteSender(*http.Request) (*http.Response, error) +1. WatcherClient.Get(context.Context, string, string, string) (Watcher, error) +1. WatcherClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.GetResponder(*http.Response) (Watcher, error) +1. WatcherClient.GetSender(*http.Request) (*http.Response, error) +1. WatcherClient.ListByAutomationAccount(context.Context, string, string, string) (WatcherListResultPage, error) +1. WatcherClient.ListByAutomationAccountComplete(context.Context, string, string, string) (WatcherListResultIterator, error) +1. WatcherClient.ListByAutomationAccountPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.ListByAutomationAccountResponder(*http.Response) (WatcherListResult, error) +1. WatcherClient.ListByAutomationAccountSender(*http.Request) (*http.Response, error) +1. WatcherClient.Start(context.Context, string, string, string) (autorest.Response, error) +1. WatcherClient.StartPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.StartResponder(*http.Response) (autorest.Response, error) +1. WatcherClient.StartSender(*http.Request) (*http.Response, error) +1. WatcherClient.Stop(context.Context, string, string, string) (autorest.Response, error) +1. WatcherClient.StopPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.StopResponder(*http.Response) (autorest.Response, error) +1. WatcherClient.StopSender(*http.Request) (*http.Response, error) +1. WatcherClient.Update(context.Context, string, string, string, WatcherUpdateParameters) (Watcher, error) +1. WatcherClient.UpdatePreparer(context.Context, string, string, string, WatcherUpdateParameters) (*http.Request, error) +1. WatcherClient.UpdateResponder(*http.Response) (Watcher, error) +1. WatcherClient.UpdateSender(*http.Request) (*http.Response, error) +1. WatcherListResult.IsEmpty() bool +1. WatcherListResultIterator.NotDone() bool +1. WatcherListResultIterator.Response() WatcherListResult +1. WatcherListResultIterator.Value() Watcher +1. WatcherListResultPage.NotDone() bool +1. WatcherListResultPage.Response() WatcherListResult +1. WatcherListResultPage.Values() []Watcher +1. WatcherProperties.MarshalJSON() ([]byte, error) +1. WatcherUpdateParameters.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. PrivateEndpointConnection +1. PrivateEndpointConnectionProperties +1. PrivateEndpointProperty +1. PrivateLinkServiceConnectionStateProperty +1. Watcher +1. WatcherClient +1. WatcherListResult +1. WatcherListResultIterator +1. WatcherListResultPage +1. WatcherProperties +1. WatcherUpdateParameters +1. WatcherUpdateProperties diff --git a/services/automation/mgmt/2015-10-31/automation/_meta.json b/services/automation/mgmt/2015-10-31/automation/_meta.json index a17b9528f8c0..ceeec039e208 100644 --- a/services/automation/mgmt/2015-10-31/automation/_meta.json +++ b/services/automation/mgmt/2015-10-31/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2015-10", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/automation/mgmt/2015-10-31/automation/automationapi/interfaces.go b/services/automation/mgmt/2015-10-31/automation/automationapi/interfaces.go index e0eb6c4b9dbe..c33cdf2b7928 100644 --- a/services/automation/mgmt/2015-10-31/automation/automationapi/interfaces.go +++ b/services/automation/mgmt/2015-10-31/automation/automationapi/interfaces.go @@ -331,6 +331,20 @@ type VariableClientAPI interface { var _ VariableClientAPI = (*automation.VariableClient)(nil) +// WatcherClientAPI contains the set of methods on the WatcherClient type. +type WatcherClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.Watcher) (result automation.Watcher, err error) + Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result automation.Watcher, err error) + ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultPage, err error) + ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultIterator, err error) + Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) + Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) + Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.WatcherUpdateParameters) (result automation.Watcher, err error) +} + +var _ WatcherClientAPI = (*automation.WatcherClient)(nil) + // WebhookClientAPI contains the set of methods on the WebhookClient type. type WebhookClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookCreateOrUpdateParameters) (result automation.Webhook, err error) diff --git a/services/automation/mgmt/2015-10-31/automation/models.go b/services/automation/mgmt/2015-10-31/automation/models.go index 3ff39f424524..a6b3cf141016 100644 --- a/services/automation/mgmt/2015-10-31/automation/models.go +++ b/services/automation/mgmt/2015-10-31/automation/models.go @@ -5755,6 +5755,116 @@ type OperationListResult struct { Value *[]Operation `json:"value,omitempty"` } +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) 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 privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointProperty private endpoint which the connection belongs to. +type PrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. +type PrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. +func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscsp.Status != nil { + objectMap["status"] = plscsp.Status + } + if plscsp.Description != nil { + objectMap["description"] = plscsp.Description + } + return json.Marshal(objectMap) +} + // ProxyResource ARM proxy resource. type ProxyResource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource @@ -7544,6 +7654,382 @@ type VariableUpdateProperties struct { Description *string `json:"description,omitempty"` } +// Watcher definition of the watcher type. +type Watcher struct { + autorest.Response `json:"-"` + // WatcherProperties - Gets or sets the watcher properties. + *WatcherProperties `json:"properties,omitempty"` + // Etag - Gets or sets the etag of the resource. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The Azure Region where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Watcher. +func (w Watcher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WatcherProperties != nil { + objectMap["properties"] = w.WatcherProperties + } + if w.Etag != nil { + objectMap["etag"] = w.Etag + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + if w.Location != nil { + objectMap["location"] = w.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Watcher struct. +func (w *Watcher) 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 watcherProperties WatcherProperties + err = json.Unmarshal(*v, &watcherProperties) + if err != nil { + return err + } + w.WatcherProperties = &watcherProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + w.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + } + } + + return nil +} + +// WatcherListResult the response model for the list watcher operation. +type WatcherListResult struct { + autorest.Response `json:"-"` + // Value - Gets or sets a list of watchers. + Value *[]Watcher `json:"value,omitempty"` + // NextLink - Gets or sets the next link. + NextLink *string `json:"nextLink,omitempty"` +} + +// WatcherListResultIterator provides access to a complete listing of Watcher values. +type WatcherListResultIterator struct { + i int + page WatcherListResultPage +} + +// 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 *WatcherListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultIterator.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 *WatcherListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WatcherListResultIterator) 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 WatcherListResultIterator) Response() WatcherListResult { + 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 WatcherListResultIterator) Value() Watcher { + if !iter.page.NotDone() { + return Watcher{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WatcherListResultIterator type. +func NewWatcherListResultIterator(page WatcherListResultPage) WatcherListResultIterator { + return WatcherListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WatcherListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WatcherListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// watcherListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WatcherListResult) watcherListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wlr.NextLink))) +} + +// WatcherListResultPage contains a page of Watcher values. +type WatcherListResultPage struct { + fn func(context.Context, WatcherListResult) (WatcherListResult, error) + wlr WatcherListResult +} + +// 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 *WatcherListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wlr) + if err != nil { + return err + } + page.wlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *WatcherListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WatcherListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WatcherListResultPage) Response() WatcherListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WatcherListResultPage) Values() []Watcher { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WatcherListResultPage type. +func NewWatcherListResultPage(cur WatcherListResult, getNextPage func(context.Context, WatcherListResult) (WatcherListResult, error)) WatcherListResultPage { + return WatcherListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WatcherProperties definition of the watcher properties +type WatcherProperties struct { + // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. + ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` + // ScriptName - Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook. + ScriptName *string `json:"scriptName,omitempty"` + // ScriptParameters - Gets or sets the parameters of the script. + ScriptParameters map[string]*string `json:"scriptParameters"` + // ScriptRunOn - Gets or sets the name of the hybrid worker group the watcher will run on. + ScriptRunOn *string `json:"scriptRunOn,omitempty"` + // Status - READ-ONLY; Gets the current status of the watcher. + Status *string `json:"status,omitempty"` + // CreationTime - READ-ONLY; Gets or sets the creation time. + CreationTime *date.Time `json:"creationTime,omitempty"` + // LastModifiedTime - READ-ONLY; Gets or sets the last modified time. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // LastModifiedBy - READ-ONLY; Details of the user who last modified the watcher. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Description - Gets or sets the description. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatcherProperties. +func (wp WatcherProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.ExecutionFrequencyInSeconds != nil { + objectMap["executionFrequencyInSeconds"] = wp.ExecutionFrequencyInSeconds + } + if wp.ScriptName != nil { + objectMap["scriptName"] = wp.ScriptName + } + if wp.ScriptParameters != nil { + objectMap["scriptParameters"] = wp.ScriptParameters + } + if wp.ScriptRunOn != nil { + objectMap["scriptRunOn"] = wp.ScriptRunOn + } + if wp.Description != nil { + objectMap["description"] = wp.Description + } + return json.Marshal(objectMap) +} + +// WatcherUpdateParameters ... +type WatcherUpdateParameters struct { + // WatcherUpdateProperties - Gets or sets the watcher update properties. + *WatcherUpdateProperties `json:"properties,omitempty"` + // Name - Gets or sets the name of the resource. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatcherUpdateParameters. +func (wup WatcherUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wup.WatcherUpdateProperties != nil { + objectMap["properties"] = wup.WatcherUpdateProperties + } + if wup.Name != nil { + objectMap["name"] = wup.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WatcherUpdateParameters struct. +func (wup *WatcherUpdateParameters) 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 watcherUpdateProperties WatcherUpdateProperties + err = json.Unmarshal(*v, &watcherUpdateProperties) + if err != nil { + return err + } + wup.WatcherUpdateProperties = &watcherUpdateProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wup.Name = &name + } + } + } + + return nil +} + +// WatcherUpdateProperties the properties of the update watcher operation. +type WatcherUpdateProperties struct { + // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. + ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` +} + // Webhook definition of the webhook type. type Webhook struct { autorest.Response `json:"-"` diff --git a/services/automation/mgmt/2015-10-31/automation/watcher.go b/services/automation/mgmt/2015-10-31/automation/watcher.go new file mode 100644 index 000000000000..f7ca3de8421f --- /dev/null +++ b/services/automation/mgmt/2015-10-31/automation/watcher.go @@ -0,0 +1,681 @@ +package automation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// WatcherClient is the automation Client +type WatcherClient struct { + BaseClient +} + +// NewWatcherClient creates an instance of the WatcherClient client. +func NewWatcherClient(subscriptionID string) WatcherClient { + return NewWatcherClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWatcherClientWithBaseURI creates an instance of the WatcherClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWatcherClientWithBaseURI(baseURI string, subscriptionID string) WatcherClient { + return WatcherClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +// parameters - the create or update parameters for watcher. +func (client WatcherClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.CreateOrUpdate") + 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("automation.WatcherClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WatcherClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", pathParameters), + autorest.WithJSON(parameters), + 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 WatcherClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WatcherClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the watcher by name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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("automation.WatcherClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WatcherClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WatcherClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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("automation.WatcherClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WatcherClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WatcherClient) GetResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of watchers. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// filter - the filter to apply on the operation. +func (client WatcherClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.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("automation.WatcherClient", "ListByAutomationAccount", err.Error()) + } + + result.fn = client.listByAutomationAccountNextResults + req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client WatcherClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client WatcherClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client WatcherClient) ListByAutomationAccountResponder(resp *http.Response) (result WatcherListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByAutomationAccountNextResults retrieves the next set of results, if any. +func (client WatcherClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WatcherListResult) (result WatcherListResult, err error) { + req, err := lastResults.watcherListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client WatcherClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") + 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) + return +} + +// Start resume the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Start") + 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("automation.WatcherClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure responding to request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client WatcherClient) StartPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client WatcherClient) StartSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client WatcherClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop resume the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Stop") + 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("automation.WatcherClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure responding to request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client WatcherClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client WatcherClient) StopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client WatcherClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +// parameters - the update parameters for watcher. +func (client WatcherClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Update") + 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("automation.WatcherClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WatcherClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", pathParameters), + autorest.WithJSON(parameters), + 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 WatcherClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WatcherClient) UpdateResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/automation/mgmt/2019-06-01/automation/CHANGELOG.md b/services/automation/mgmt/2019-06-01/automation/CHANGELOG.md index 52911e4cc5e4..7a074be4b466 100644 --- a/services/automation/mgmt/2019-06-01/automation/CHANGELOG.md +++ b/services/automation/mgmt/2019-06-01/automation/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. PrivateEndpointConnectionProperties.GroupIds diff --git a/services/automation/mgmt/2019-06-01/automation/_meta.json b/services/automation/mgmt/2019-06-01/automation/_meta.json index 167755cf7975..6525575b9c4a 100644 --- a/services/automation/mgmt/2019-06-01/automation/_meta.json +++ b/services/automation/mgmt/2019-06-01/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "b47572ab2069865484c493a4f679d4e72f8b303d", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2019-06", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/automation/mgmt/2019-06-01/automation/models.go b/services/automation/mgmt/2019-06-01/automation/models.go index 8feb9312b1c3..883a23c1aae2 100644 --- a/services/automation/mgmt/2019-06-01/automation/models.go +++ b/services/automation/mgmt/2019-06-01/automation/models.go @@ -6418,6 +6418,8 @@ func (pec *PrivateEndpointConnection) UnmarshalJSON(body []byte) error { type PrivateEndpointConnectionProperties struct { // PrivateEndpoint - Private endpoint which the connection belongs to. PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` } diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md index 52911e4cc5e4..ce1aeaeccd94 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/CHANGELOG.md @@ -1,2 +1,75 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. *PrivateEndpointConnection.UnmarshalJSON([]byte) error +1. *Watcher.UnmarshalJSON([]byte) error +1. *WatcherListResultIterator.Next() error +1. *WatcherListResultIterator.NextWithContext(context.Context) error +1. *WatcherListResultPage.Next() error +1. *WatcherListResultPage.NextWithContext(context.Context) error +1. *WatcherUpdateParameters.UnmarshalJSON([]byte) error +1. NewWatcherClient(string) WatcherClient +1. NewWatcherClientWithBaseURI(string, string) WatcherClient +1. NewWatcherListResultIterator(WatcherListResultPage) WatcherListResultIterator +1. NewWatcherListResultPage(WatcherListResult, func(context.Context, WatcherListResult) (WatcherListResult, error)) WatcherListResultPage +1. PrivateEndpointConnection.MarshalJSON() ([]byte, error) +1. PrivateLinkServiceConnectionStateProperty.MarshalJSON() ([]byte, error) +1. Watcher.MarshalJSON() ([]byte, error) +1. WatcherClient.CreateOrUpdate(context.Context, string, string, string, Watcher) (Watcher, error) +1. WatcherClient.CreateOrUpdatePreparer(context.Context, string, string, string, Watcher) (*http.Request, error) +1. WatcherClient.CreateOrUpdateResponder(*http.Response) (Watcher, error) +1. WatcherClient.CreateOrUpdateSender(*http.Request) (*http.Response, error) +1. WatcherClient.Delete(context.Context, string, string, string) (autorest.Response, error) +1. WatcherClient.DeletePreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.DeleteResponder(*http.Response) (autorest.Response, error) +1. WatcherClient.DeleteSender(*http.Request) (*http.Response, error) +1. WatcherClient.Get(context.Context, string, string, string) (Watcher, error) +1. WatcherClient.GetPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.GetResponder(*http.Response) (Watcher, error) +1. WatcherClient.GetSender(*http.Request) (*http.Response, error) +1. WatcherClient.ListByAutomationAccount(context.Context, string, string, string) (WatcherListResultPage, error) +1. WatcherClient.ListByAutomationAccountComplete(context.Context, string, string, string) (WatcherListResultIterator, error) +1. WatcherClient.ListByAutomationAccountPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.ListByAutomationAccountResponder(*http.Response) (WatcherListResult, error) +1. WatcherClient.ListByAutomationAccountSender(*http.Request) (*http.Response, error) +1. WatcherClient.Start(context.Context, string, string, string) (autorest.Response, error) +1. WatcherClient.StartPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.StartResponder(*http.Response) (autorest.Response, error) +1. WatcherClient.StartSender(*http.Request) (*http.Response, error) +1. WatcherClient.Stop(context.Context, string, string, string) (autorest.Response, error) +1. WatcherClient.StopPreparer(context.Context, string, string, string) (*http.Request, error) +1. WatcherClient.StopResponder(*http.Response) (autorest.Response, error) +1. WatcherClient.StopSender(*http.Request) (*http.Response, error) +1. WatcherClient.Update(context.Context, string, string, string, WatcherUpdateParameters) (Watcher, error) +1. WatcherClient.UpdatePreparer(context.Context, string, string, string, WatcherUpdateParameters) (*http.Request, error) +1. WatcherClient.UpdateResponder(*http.Response) (Watcher, error) +1. WatcherClient.UpdateSender(*http.Request) (*http.Response, error) +1. WatcherListResult.IsEmpty() bool +1. WatcherListResultIterator.NotDone() bool +1. WatcherListResultIterator.Response() WatcherListResult +1. WatcherListResultIterator.Value() Watcher +1. WatcherListResultPage.NotDone() bool +1. WatcherListResultPage.Response() WatcherListResult +1. WatcherListResultPage.Values() []Watcher +1. WatcherProperties.MarshalJSON() ([]byte, error) +1. WatcherUpdateParameters.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. PrivateEndpointConnection +1. PrivateEndpointConnectionProperties +1. PrivateEndpointProperty +1. PrivateLinkServiceConnectionStateProperty +1. Watcher +1. WatcherClient +1. WatcherListResult +1. WatcherListResultIterator +1. WatcherListResultPage +1. WatcherProperties +1. WatcherUpdateParameters +1. WatcherUpdateProperties diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json b/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json index 466ba67e8645..3fc3c700793e 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2017-05-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go index b1f860865b98..f131e99e0a31 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/automationapi/interfaces.go @@ -307,6 +307,20 @@ type VariableClientAPI interface { var _ VariableClientAPI = (*automation.VariableClient)(nil) +// WatcherClientAPI contains the set of methods on the WatcherClient type. +type WatcherClientAPI interface { + CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.Watcher) (result automation.Watcher, err error) + Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) + Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result automation.Watcher, err error) + ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultPage, err error) + ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result automation.WatcherListResultIterator, err error) + Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) + Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) + Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters automation.WatcherUpdateParameters) (result automation.Watcher, err error) +} + +var _ WatcherClientAPI = (*automation.WatcherClient)(nil) + // WebhookClientAPI contains the set of methods on the WebhookClient type. type WebhookClientAPI interface { CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, webhookName string, parameters automation.WebhookCreateOrUpdateParameters) (result automation.Webhook, err error) diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go index cff5a3424011..e9e22dc7fd27 100644 --- a/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/models.go @@ -5927,6 +5927,116 @@ type OperationListResult struct { Value *[]Operation `json:"value,omitempty"` } +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) 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 privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointProperty private endpoint which the connection belongs to. +type PrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. +type PrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. +func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscsp.Status != nil { + objectMap["status"] = plscsp.Status + } + if plscsp.Description != nil { + objectMap["description"] = plscsp.Description + } + return json.Marshal(objectMap) +} + // ProxyResource ARM proxy resource. type ProxyResource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource @@ -9388,6 +9498,382 @@ type VariableUpdateProperties struct { Description *string `json:"description,omitempty"` } +// Watcher definition of the watcher type. +type Watcher struct { + autorest.Response `json:"-"` + // WatcherProperties - Gets or sets the watcher properties. + *WatcherProperties `json:"properties,omitempty"` + // Etag - Gets or sets the etag of the resource. + Etag *string `json:"etag,omitempty"` + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The Azure Region where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Watcher. +func (w Watcher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.WatcherProperties != nil { + objectMap["properties"] = w.WatcherProperties + } + if w.Etag != nil { + objectMap["etag"] = w.Etag + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + if w.Location != nil { + objectMap["location"] = w.Location + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Watcher struct. +func (w *Watcher) 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 watcherProperties WatcherProperties + err = json.Unmarshal(*v, &watcherProperties) + if err != nil { + return err + } + w.WatcherProperties = &watcherProperties + } + case "etag": + if v != nil { + var etag string + err = json.Unmarshal(*v, &etag) + if err != nil { + return err + } + w.Etag = &etag + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + w.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + w.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + w.Type = &typeVar + } + } + } + + return nil +} + +// WatcherListResult the response model for the list watcher operation. +type WatcherListResult struct { + autorest.Response `json:"-"` + // Value - Gets or sets a list of watchers. + Value *[]Watcher `json:"value,omitempty"` + // NextLink - Gets or sets the next link. + NextLink *string `json:"nextLink,omitempty"` +} + +// WatcherListResultIterator provides access to a complete listing of Watcher values. +type WatcherListResultIterator struct { + i int + page WatcherListResultPage +} + +// 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 *WatcherListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultIterator.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 *WatcherListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + +// NotDone returns true if the enumeration should be started or is not yet complete. +func (iter WatcherListResultIterator) 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 WatcherListResultIterator) Response() WatcherListResult { + 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 WatcherListResultIterator) Value() Watcher { + if !iter.page.NotDone() { + return Watcher{} + } + return iter.page.Values()[iter.i] +} + +// Creates a new instance of the WatcherListResultIterator type. +func NewWatcherListResultIterator(page WatcherListResultPage) WatcherListResultIterator { + return WatcherListResultIterator{page: page} +} + +// IsEmpty returns true if the ListResult contains no values. +func (wlr WatcherListResult) IsEmpty() bool { + return wlr.Value == nil || len(*wlr.Value) == 0 +} + +// hasNextLink returns true if the NextLink is not empty. +func (wlr WatcherListResult) hasNextLink() bool { + return wlr.NextLink != nil && len(*wlr.NextLink) != 0 +} + +// watcherListResultPreparer prepares a request to retrieve the next set of results. +// It returns nil if no more results exist. +func (wlr WatcherListResult) watcherListResultPreparer(ctx context.Context) (*http.Request, error) { + if !wlr.hasNextLink() { + return nil, nil + } + return autorest.Prepare((&http.Request{}).WithContext(ctx), + autorest.AsJSON(), + autorest.AsGet(), + autorest.WithBaseURL(to.String(wlr.NextLink))) +} + +// WatcherListResultPage contains a page of Watcher values. +type WatcherListResultPage struct { + fn func(context.Context, WatcherListResult) (WatcherListResult, error) + wlr WatcherListResult +} + +// 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 *WatcherListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + for { + next, err := page.fn(ctx, page.wlr) + if err != nil { + return err + } + page.wlr = next + if !next.hasNextLink() || !next.IsEmpty() { + break + } + } + 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 *WatcherListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + +// NotDone returns true if the page enumeration should be started or is not yet complete. +func (page WatcherListResultPage) NotDone() bool { + return !page.wlr.IsEmpty() +} + +// Response returns the raw server response from the last page request. +func (page WatcherListResultPage) Response() WatcherListResult { + return page.wlr +} + +// Values returns the slice of values for the current page or nil if there are no values. +func (page WatcherListResultPage) Values() []Watcher { + if page.wlr.IsEmpty() { + return nil + } + return *page.wlr.Value +} + +// Creates a new instance of the WatcherListResultPage type. +func NewWatcherListResultPage(cur WatcherListResult, getNextPage func(context.Context, WatcherListResult) (WatcherListResult, error)) WatcherListResultPage { + return WatcherListResultPage{ + fn: getNextPage, + wlr: cur, + } +} + +// WatcherProperties definition of the watcher properties +type WatcherProperties struct { + // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. + ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` + // ScriptName - Gets or sets the name of the script the watcher is attached to, i.e. the name of an existing runbook. + ScriptName *string `json:"scriptName,omitempty"` + // ScriptParameters - Gets or sets the parameters of the script. + ScriptParameters map[string]*string `json:"scriptParameters"` + // ScriptRunOn - Gets or sets the name of the hybrid worker group the watcher will run on. + ScriptRunOn *string `json:"scriptRunOn,omitempty"` + // Status - READ-ONLY; Gets the current status of the watcher. + Status *string `json:"status,omitempty"` + // CreationTime - READ-ONLY; Gets or sets the creation time. + CreationTime *date.Time `json:"creationTime,omitempty"` + // LastModifiedTime - READ-ONLY; Gets or sets the last modified time. + LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` + // LastModifiedBy - READ-ONLY; Details of the user who last modified the watcher. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + // Description - Gets or sets the description. + Description *string `json:"description,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatcherProperties. +func (wp WatcherProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wp.ExecutionFrequencyInSeconds != nil { + objectMap["executionFrequencyInSeconds"] = wp.ExecutionFrequencyInSeconds + } + if wp.ScriptName != nil { + objectMap["scriptName"] = wp.ScriptName + } + if wp.ScriptParameters != nil { + objectMap["scriptParameters"] = wp.ScriptParameters + } + if wp.ScriptRunOn != nil { + objectMap["scriptRunOn"] = wp.ScriptRunOn + } + if wp.Description != nil { + objectMap["description"] = wp.Description + } + return json.Marshal(objectMap) +} + +// WatcherUpdateParameters ... +type WatcherUpdateParameters struct { + // WatcherUpdateProperties - Gets or sets the watcher update properties. + *WatcherUpdateProperties `json:"properties,omitempty"` + // Name - Gets or sets the name of the resource. + Name *string `json:"name,omitempty"` +} + +// MarshalJSON is the custom marshaler for WatcherUpdateParameters. +func (wup WatcherUpdateParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if wup.WatcherUpdateProperties != nil { + objectMap["properties"] = wup.WatcherUpdateProperties + } + if wup.Name != nil { + objectMap["name"] = wup.Name + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for WatcherUpdateParameters struct. +func (wup *WatcherUpdateParameters) 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 watcherUpdateProperties WatcherUpdateProperties + err = json.Unmarshal(*v, &watcherUpdateProperties) + if err != nil { + return err + } + wup.WatcherUpdateProperties = &watcherUpdateProperties + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + wup.Name = &name + } + } + } + + return nil +} + +// WatcherUpdateProperties the properties of the update watcher operation. +type WatcherUpdateProperties struct { + // ExecutionFrequencyInSeconds - Gets or sets the frequency at which the watcher is invoked. + ExecutionFrequencyInSeconds *int64 `json:"executionFrequencyInSeconds,omitempty"` +} + // Webhook definition of the webhook type. type Webhook struct { autorest.Response `json:"-"` diff --git a/services/preview/automation/mgmt/2017-05-15-preview/automation/watcher.go b/services/preview/automation/mgmt/2017-05-15-preview/automation/watcher.go new file mode 100644 index 000000000000..f7ca3de8421f --- /dev/null +++ b/services/preview/automation/mgmt/2017-05-15-preview/automation/watcher.go @@ -0,0 +1,681 @@ +package automation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// +// 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" +) + +// WatcherClient is the automation Client +type WatcherClient struct { + BaseClient +} + +// NewWatcherClient creates an instance of the WatcherClient client. +func NewWatcherClient(subscriptionID string) WatcherClient { + return NewWatcherClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWatcherClientWithBaseURI creates an instance of the WatcherClient client using a custom endpoint. Use this when +// interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). +func NewWatcherClientWithBaseURI(baseURI string, subscriptionID string) WatcherClient { + return WatcherClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +// parameters - the create or update parameters for watcher. +func (client WatcherClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.CreateOrUpdate") + 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("automation.WatcherClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "CreateOrUpdate", resp, "Failure responding to request") + return + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WatcherClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters Watcher) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", pathParameters), + autorest.WithJSON(parameters), + 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 WatcherClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WatcherClient) CreateOrUpdateResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete the watcher by name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Delete(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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("automation.WatcherClient", "Delete", err.Error()) + } + + req, err := client.DeletePreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Delete", resp, "Failure responding to request") + return + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WatcherClient) DeletePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) DeleteSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WatcherClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get retrieve the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Get(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.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("automation.WatcherClient", "Get", err.Error()) + } + + req, err := client.GetPreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Get", resp, "Failure responding to request") + return + } + + return +} + +// GetPreparer prepares the Get request. +func (client WatcherClient) GetPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", 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 WatcherClient) GetSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WatcherClient) GetResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByAutomationAccount retrieve a list of watchers. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// filter - the filter to apply on the operation. +func (client WatcherClient) ListByAutomationAccount(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") + defer func() { + sc := -1 + if result.wlr.Response.Response != nil { + sc = result.wlr.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("automation.WatcherClient", "ListByAutomationAccount", err.Error()) + } + + result.fn = client.listByAutomationAccountNextResults + req, err := client.ListByAutomationAccountPreparer(ctx, resourceGroupName, automationAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.wlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure sending request") + return + } + + result.wlr, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "ListByAutomationAccount", resp, "Failure responding to request") + return + } + if result.wlr.hasNextLink() && result.wlr.IsEmpty() { + err = result.NextWithContext(ctx) + return + } + + return +} + +// ListByAutomationAccountPreparer prepares the ListByAutomationAccount request. +func (client WatcherClient) ListByAutomationAccountPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByAutomationAccountSender sends the ListByAutomationAccount request. The method will close the +// http.Response Body if it receives an error. +func (client WatcherClient) ListByAutomationAccountSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// ListByAutomationAccountResponder handles the response to the ListByAutomationAccount request. The method always +// closes the http.Response Body. +func (client WatcherClient) ListByAutomationAccountResponder(resp *http.Response) (result WatcherListResult, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByAutomationAccountNextResults retrieves the next set of results, if any. +func (client WatcherClient) listByAutomationAccountNextResults(ctx context.Context, lastResults WatcherListResult) (result WatcherListResult, err error) { + req, err := lastResults.watcherListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByAutomationAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByAutomationAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "listByAutomationAccountNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByAutomationAccountComplete enumerates all values, automatically crossing page boundaries as required. +func (client WatcherClient) ListByAutomationAccountComplete(ctx context.Context, resourceGroupName string, automationAccountName string, filter string) (result WatcherListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.ListByAutomationAccount") + 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.ListByAutomationAccount(ctx, resourceGroupName, automationAccountName, filter) + return +} + +// Start resume the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Start(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Start") + 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("automation.WatcherClient", "Start", err.Error()) + } + + req, err := client.StartPreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", nil, "Failure preparing request") + return + } + + resp, err := client.StartSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure sending request") + return + } + + result, err = client.StartResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Start", resp, "Failure responding to request") + return + } + + return +} + +// StartPreparer prepares the Start request. +func (client WatcherClient) StartPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StartSender sends the Start request. The method will close the +// http.Response Body if it receives an error. +func (client WatcherClient) StartSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StartResponder handles the response to the Start request. The method always +// closes the http.Response Body. +func (client WatcherClient) StartResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Stop resume the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +func (client WatcherClient) Stop(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Stop") + 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("automation.WatcherClient", "Stop", err.Error()) + } + + req, err := client.StopPreparer(ctx, resourceGroupName, automationAccountName, watcherName) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", nil, "Failure preparing request") + return + } + + resp, err := client.StopSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure sending request") + return + } + + result, err = client.StopResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Stop", resp, "Failure responding to request") + return + } + + return +} + +// StopPreparer prepares the Stop request. +func (client WatcherClient) StopPreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// StopSender sends the Stop request. The method will close the +// http.Response Body if it receives an error. +func (client WatcherClient) StopSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// StopResponder handles the response to the Stop request. The method always +// closes the http.Response Body. +func (client WatcherClient) StopResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Update update the watcher identified by watcher name. +// Parameters: +// resourceGroupName - name of an Azure Resource group. +// automationAccountName - the name of the automation account. +// watcherName - the watcher name. +// parameters - the update parameters for watcher. +func (client WatcherClient) Update(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (result Watcher, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WatcherClient.Update") + 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("automation.WatcherClient", "Update", err.Error()) + } + + req, err := client.UpdatePreparer(ctx, resourceGroupName, automationAccountName, watcherName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "automation.WatcherClient", "Update", resp, "Failure responding to request") + return + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WatcherClient) UpdatePreparer(ctx context.Context, resourceGroupName string, automationAccountName string, watcherName string, parameters WatcherUpdateParameters) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "automationAccountName": autorest.Encode("path", automationAccountName), + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "watcherName": autorest.Encode("path", watcherName), + } + + const APIVersion = "2015-10-31" + 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.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}", pathParameters), + autorest.WithJSON(parameters), + 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 WatcherClient) UpdateSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WatcherClient) UpdateResponder(resp *http.Response) (result Watcher, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md index 52911e4cc5e4..e509e3a66eb8 100644 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md +++ b/services/preview/automation/mgmt/2018-01-15-preview/automation/CHANGELOG.md @@ -1,2 +1,18 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. *PrivateEndpointConnection.UnmarshalJSON([]byte) error +1. PrivateEndpointConnection.MarshalJSON() ([]byte, error) +1. PrivateLinkServiceConnectionStateProperty.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. PrivateEndpointConnection +1. PrivateEndpointConnectionProperties +1. PrivateEndpointProperty +1. PrivateLinkServiceConnectionStateProperty diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json b/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json index e2c96ce4b527..7afb1dd93537 100644 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json +++ b/services/preview/automation/mgmt/2018-01-15-preview/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2018-01-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automation/mgmt/2018-01-15-preview/automation/models.go b/services/preview/automation/mgmt/2018-01-15-preview/automation/models.go index 127c2c27849b..ef732098fb10 100644 --- a/services/preview/automation/mgmt/2018-01-15-preview/automation/models.go +++ b/services/preview/automation/mgmt/2018-01-15-preview/automation/models.go @@ -6352,6 +6352,116 @@ type OperationListResult struct { Value *[]Operation `json:"value,omitempty"` } +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) 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 privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointProperty private endpoint which the connection belongs to. +type PrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. +type PrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. +func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscsp.Status != nil { + objectMap["status"] = plscsp.Status + } + if plscsp.Description != nil { + objectMap["description"] = plscsp.Description + } + return json.Marshal(objectMap) +} + // ProxyResource ARM proxy resource. type ProxyResource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md index 52911e4cc5e4..e509e3a66eb8 100644 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md +++ b/services/preview/automation/mgmt/2018-06-30-preview/automation/CHANGELOG.md @@ -1,2 +1,18 @@ -# Change History +# Unreleased +## Additive Changes + +### New Funcs + +1. *PrivateEndpointConnection.UnmarshalJSON([]byte) error +1. PrivateEndpointConnection.MarshalJSON() ([]byte, error) +1. PrivateLinkServiceConnectionStateProperty.MarshalJSON() ([]byte, error) + +### Struct Changes + +#### New Structs + +1. PrivateEndpointConnection +1. PrivateEndpointConnectionProperties +1. PrivateEndpointProperty +1. PrivateLinkServiceConnectionStateProperty diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json b/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json index ba6fc4135afb..3fcbcf3bea87 100644 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json +++ b/services/preview/automation/mgmt/2018-06-30-preview/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3c764635e7d442b3e74caf593029fcd440b3ef82", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2018-06-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automation/mgmt/2018-06-30-preview/automation/models.go b/services/preview/automation/mgmt/2018-06-30-preview/automation/models.go index 0835ff70f645..92bb90167b93 100644 --- a/services/preview/automation/mgmt/2018-06-30-preview/automation/models.go +++ b/services/preview/automation/mgmt/2018-06-30-preview/automation/models.go @@ -6352,6 +6352,116 @@ type OperationListResult struct { Value *[]Operation `json:"value,omitempty"` } +// PrivateEndpointConnection a private endpoint connection +type PrivateEndpointConnection struct { + // PrivateEndpointConnectionProperties - Resource properties. + *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateEndpointConnection. +func (pec PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if pec.PrivateEndpointConnectionProperties != nil { + objectMap["properties"] = pec.PrivateEndpointConnectionProperties + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for PrivateEndpointConnection struct. +func (pec *PrivateEndpointConnection) 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 privateEndpointConnectionProperties PrivateEndpointConnectionProperties + err = json.Unmarshal(*v, &privateEndpointConnectionProperties) + if err != nil { + return err + } + pec.PrivateEndpointConnectionProperties = &privateEndpointConnectionProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + pec.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + pec.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + pec.Type = &typeVar + } + } + } + + return nil +} + +// PrivateEndpointConnectionProperties properties of a private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // PrivateEndpoint - Private endpoint which the connection belongs to. + PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` + // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` +} + +// PrivateEndpointProperty private endpoint which the connection belongs to. +type PrivateEndpointProperty struct { + // ID - Resource id of the private endpoint. + ID *string `json:"id,omitempty"` +} + +// PrivateLinkServiceConnectionStateProperty connection State of the Private Endpoint Connection. +type PrivateLinkServiceConnectionStateProperty struct { + // Status - The private link service connection status. + Status *string `json:"status,omitempty"` + // Description - The private link service connection description. + Description *string `json:"description,omitempty"` + // ActionsRequired - READ-ONLY; Any action that is required beyond basic workflow (approve/ reject/ disconnect) + ActionsRequired *string `json:"actionsRequired,omitempty"` +} + +// MarshalJSON is the custom marshaler for PrivateLinkServiceConnectionStateProperty. +func (plscsp PrivateLinkServiceConnectionStateProperty) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if plscsp.Status != nil { + objectMap["status"] = plscsp.Status + } + if plscsp.Description != nil { + objectMap["description"] = plscsp.Description + } + return json.Marshal(objectMap) +} + // ProxyResource ARM proxy resource. type ProxyResource struct { // ID - READ-ONLY; Fully qualified resource Id for the resource diff --git a/services/preview/automation/mgmt/2020-01-13-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2020-01-13-preview/automation/CHANGELOG.md index 52911e4cc5e4..7a074be4b466 100644 --- a/services/preview/automation/mgmt/2020-01-13-preview/automation/CHANGELOG.md +++ b/services/preview/automation/mgmt/2020-01-13-preview/automation/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. PrivateEndpointConnectionProperties.GroupIds diff --git a/services/preview/automation/mgmt/2020-01-13-preview/automation/_meta.json b/services/preview/automation/mgmt/2020-01-13-preview/automation/_meta.json index 66f1656631dc..d9d0512018b6 100644 --- a/services/preview/automation/mgmt/2020-01-13-preview/automation/_meta.json +++ b/services/preview/automation/mgmt/2020-01-13-preview/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "3b9b0a930e29cbead33df69ae46c7080408e4c0f", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2020-01-13-preview", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automation/mgmt/2020-01-13-preview/automation/models.go b/services/preview/automation/mgmt/2020-01-13-preview/automation/models.go index c0d324c7a303..c414030fd27b 100644 --- a/services/preview/automation/mgmt/2020-01-13-preview/automation/models.go +++ b/services/preview/automation/mgmt/2020-01-13-preview/automation/models.go @@ -6555,6 +6555,8 @@ type PrivateEndpointConnectionListResult struct { type PrivateEndpointConnectionProperties struct { // PrivateEndpoint - Private endpoint which the connection belongs to. PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` } diff --git a/services/preview/automation/mgmt/2021-06-22-preview/automation/CHANGELOG.md b/services/preview/automation/mgmt/2021-06-22-preview/automation/CHANGELOG.md index 52911e4cc5e4..7a074be4b466 100644 --- a/services/preview/automation/mgmt/2021-06-22-preview/automation/CHANGELOG.md +++ b/services/preview/automation/mgmt/2021-06-22-preview/automation/CHANGELOG.md @@ -1,2 +1,9 @@ -# Change History +# Unreleased +## Additive Changes + +### Struct Changes + +#### New Struct Fields + +1. PrivateEndpointConnectionProperties.GroupIds diff --git a/services/preview/automation/mgmt/2021-06-22-preview/automation/_meta.json b/services/preview/automation/mgmt/2021-06-22-preview/automation/_meta.json index 6202bdf47d07..56ecec5435ca 100644 --- a/services/preview/automation/mgmt/2021-06-22-preview/automation/_meta.json +++ b/services/preview/automation/mgmt/2021-06-22-preview/automation/_meta.json @@ -1,5 +1,5 @@ { - "commit": "25a8355d4094595edf9b58b13e8c95b0b0c9c50c", + "commit": "08787804dfe51d7000ca3b3b764a3395379e41b3", "readme": "/_/azure-rest-api-specs/specification/automation/resource-manager/readme.md", "tag": "package-2021-06-22", "use": "@microsoft.azure/autorest.go@2.1.187", diff --git a/services/preview/automation/mgmt/2021-06-22-preview/automation/models.go b/services/preview/automation/mgmt/2021-06-22-preview/automation/models.go index 93befc1146c4..53be73cb51a8 100644 --- a/services/preview/automation/mgmt/2021-06-22-preview/automation/models.go +++ b/services/preview/automation/mgmt/2021-06-22-preview/automation/models.go @@ -6957,6 +6957,8 @@ type PrivateEndpointConnectionListResult struct { type PrivateEndpointConnectionProperties struct { // PrivateEndpoint - Private endpoint which the connection belongs to. PrivateEndpoint *PrivateEndpointProperty `json:"privateEndpoint,omitempty"` + // GroupIds - Gets the groupIds. + GroupIds *[]string `json:"groupIds,omitempty"` // PrivateLinkServiceConnectionState - Connection State of the Private Endpoint Connection. PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionStateProperty `json:"privateLinkServiceConnectionState,omitempty"` }