diff --git a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/models.go b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/models.go index 1e5b422a5761..3a642c665608 100644 --- a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/models.go +++ b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/models.go @@ -60,6 +60,31 @@ func PossibleSearchSortEnumValues() []SearchSortEnum { return []SearchSortEnum{Asc, Desc} } +// SkuNameEnum enumerates the values for sku name enum. +type SkuNameEnum string + +const ( + // CapacityReservation ... + CapacityReservation SkuNameEnum = "CapacityReservation" + // Free ... + Free SkuNameEnum = "Free" + // PerGB2018 ... + PerGB2018 SkuNameEnum = "PerGB2018" + // PerNode ... + PerNode SkuNameEnum = "PerNode" + // Premium ... + Premium SkuNameEnum = "Premium" + // Standalone ... + Standalone SkuNameEnum = "Standalone" + // Standard ... + Standard SkuNameEnum = "Standard" +) + +// PossibleSkuNameEnumValues returns an array of possible values for the SkuNameEnum const type. +func PossibleSkuNameEnumValues() []SkuNameEnum { + return []SkuNameEnum{CapacityReservation, Free, PerGB2018, PerNode, Premium, Standalone, Standard} +} + // StorageInsightState enumerates the values for storage insight state. type StorageInsightState string @@ -75,6 +100,24 @@ func PossibleStorageInsightStateValues() []StorageInsightState { return []StorageInsightState{ERROR, OK} } +// AvailableServiceTier service Tier details. +type AvailableServiceTier struct { + // ServiceTier - READ-ONLY; The name of the Service Tier. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation' + ServiceTier SkuNameEnum `json:"ServiceTier,omitempty"` + // Enabled - READ-ONLY; True if the Service Tier is enabled for the workspace. + Enabled *bool `json:"Enabled,omitempty"` + // MinimumRetention - READ-ONLY; The minimum retention for the Service Tier, in days. + MinimumRetention *int64 `json:"MinimumRetention,omitempty"` + // MaximumRetention - READ-ONLY; The maximum retention for the Service Tier, in days. + MaximumRetention *int64 `json:"MaximumRetention,omitempty"` + // DefaultRetention - READ-ONLY; The default retention for the Service Tier, in days. + DefaultRetention *int64 `json:"DefaultRetention,omitempty"` + // CapacityReservationLevel - READ-ONLY; The capacity reservation level in GB per day. Returned for the Capacity Reservation Service Tier. + CapacityReservationLevel *int64 `json:"CapacityReservationLevel,omitempty"` + // LastSkuUpdate - READ-ONLY; Time when the sku was last updated for the workspace. Returned for the Capacity Reservation Service Tier. + LastSkuUpdate *date.Time `json:"LastSkuUpdate,omitempty"` +} + // CoreSummary the core summary of a search. type CoreSummary struct { // Status - The status of a core summary. @@ -95,6 +138,12 @@ type LinkTarget struct { Location *string `json:"location,omitempty"` } +// ListAvailableServiceTier ... +type ListAvailableServiceTier struct { + autorest.Response `json:"-"` + Value *[]AvailableServiceTier `json:"value,omitempty"` +} + // ListLinkTarget ... type ListLinkTarget struct { autorest.Response `json:"-"` diff --git a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operationalinsightsapi/interfaces.go b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operationalinsightsapi/interfaces.go index d9254ced9ae5..d5a6264cff8b 100644 --- a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operationalinsightsapi/interfaces.go +++ b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operationalinsightsapi/interfaces.go @@ -36,6 +36,7 @@ var _ StorageInsightsClientAPI = (*operationalinsights.StorageInsightsClient)(ni // WorkspacesClientAPI contains the set of methods on the WorkspacesClient type. type WorkspacesClientAPI interface { + AvailableServiceTiers(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.ListAvailableServiceTier, err error) DeleteGateways(ctx context.Context, resourceGroupName string, workspaceName string, gatewayID string) (result autorest.Response, err error) GetPurgeStatus(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.WorkspacePurgeStatusResponse, err error) GetSchema(ctx context.Context, resourceGroupName string, workspaceName string) (result operationalinsights.SearchGetSchemaResponse, err error) diff --git a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operations.go b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operations.go index 2b9f300322a0..99dff7bc4563 100644 --- a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operations.go +++ b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/operations.go @@ -92,8 +92,7 @@ func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, // ListSender sends the List request. The method will close the // http.Response Body if it receives an error. func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // ListResponder handles the response to the List request. The method always diff --git a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/savedsearches.go b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/savedsearches.go index 71c46ec51244..97b5e866e9da 100644 --- a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/savedsearches.go +++ b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/savedsearches.go @@ -128,8 +128,7 @@ func (client SavedSearchesClient) CreateOrUpdatePreparer(ctx context.Context, re // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client SavedSearchesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always @@ -215,8 +214,7 @@ func (client SavedSearchesClient) DeletePreparer(ctx context.Context, resourceGr // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client SavedSearchesClient) DeleteSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always @@ -301,8 +299,7 @@ func (client SavedSearchesClient) GetPreparer(ctx context.Context, resourceGroup // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client SavedSearchesClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -386,8 +383,7 @@ func (client SavedSearchesClient) ListByWorkspacePreparer(ctx context.Context, r // ListByWorkspaceSender sends the ListByWorkspace request. The method will close the // http.Response Body if it receives an error. func (client SavedSearchesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always diff --git a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/storageinsights.go b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/storageinsights.go index 8bb3ff833624..6fdc9fa49c36 100644 --- a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/storageinsights.go +++ b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/storageinsights.go @@ -122,8 +122,7 @@ func (client StorageInsightsClient) CreateOrUpdatePreparer(ctx context.Context, // CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the // http.Response Body if it receives an error. func (client StorageInsightsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always @@ -209,8 +208,7 @@ func (client StorageInsightsClient) DeletePreparer(ctx context.Context, resource // DeleteSender sends the Delete request. The method will close the // http.Response Body if it receives an error. func (client StorageInsightsClient) DeleteSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteResponder handles the response to the Delete request. The method always @@ -295,8 +293,7 @@ func (client StorageInsightsClient) GetPreparer(ctx context.Context, resourceGro // GetSender sends the Get request. The method will close the // http.Response Body if it receives an error. func (client StorageInsightsClient) GetSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetResponder handles the response to the Get request. The method always @@ -381,8 +378,7 @@ func (client StorageInsightsClient) ListByWorkspacePreparer(ctx context.Context, // ListByWorkspaceSender sends the ListByWorkspace request. The method will close the // http.Response Body if it receives an error. func (client StorageInsightsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always diff --git a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/workspaces.go b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/workspaces.go index 78e6919aa33a..dfc9d78c5fc7 100644 --- a/services/operationalinsights/mgmt/2015-03-20/operationalinsights/workspaces.go +++ b/services/operationalinsights/mgmt/2015-03-20/operationalinsights/workspaces.go @@ -42,6 +42,90 @@ func NewWorkspacesClientWithBaseURI(baseURI string, subscriptionID string, purge return WorkspacesClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} } +// AvailableServiceTiers gets the available service tiers for the workspace. +// Parameters: +// resourceGroupName - the Resource Group name. +// workspaceName - the Log Analytics Workspace name. +func (client WorkspacesClient) AvailableServiceTiers(ctx context.Context, resourceGroupName string, workspaceName string) (result ListAvailableServiceTier, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/WorkspacesClient.AvailableServiceTiers") + 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("operationalinsights.WorkspacesClient", "AvailableServiceTiers", err.Error()) + } + + req, err := client.AvailableServiceTiersPreparer(ctx, resourceGroupName, workspaceName) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "AvailableServiceTiers", nil, "Failure preparing request") + return + } + + resp, err := client.AvailableServiceTiersSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "AvailableServiceTiers", resp, "Failure sending request") + return + } + + result, err = client.AvailableServiceTiersResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "operationalinsights.WorkspacesClient", "AvailableServiceTiers", resp, "Failure responding to request") + } + + return +} + +// AvailableServiceTiersPreparer prepares the AvailableServiceTiers request. +func (client WorkspacesClient) AvailableServiceTiersPreparer(ctx context.Context, resourceGroupName string, workspaceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + "workspaceName": autorest.Encode("path", workspaceName), + } + + const APIVersion = "2015-03-20" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AvailableServiceTiersSender sends the AvailableServiceTiers request. The method will close the +// http.Response Body if it receives an error. +func (client WorkspacesClient) AvailableServiceTiersSender(req *http.Request) (*http.Response, error) { + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) +} + +// AvailableServiceTiersResponder handles the response to the AvailableServiceTiers request. The method always +// closes the http.Response Body. +func (client WorkspacesClient) AvailableServiceTiersResponder(resp *http.Response) (result ListAvailableServiceTier, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Value), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // DeleteGateways delete a Log Analytics gateway. // Parameters: // resourceGroupName - the Resource Group name. @@ -112,8 +196,7 @@ func (client WorkspacesClient) DeleteGatewaysPreparer(ctx context.Context, resou // DeleteGatewaysSender sends the DeleteGateways request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) DeleteGatewaysSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // DeleteGatewaysResponder handles the response to the DeleteGateways request. The method always @@ -197,8 +280,7 @@ func (client WorkspacesClient) GetPurgeStatusPreparer(ctx context.Context, resou // GetPurgeStatusSender sends the GetPurgeStatus request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) GetPurgeStatusSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetPurgeStatusResponder handles the response to the GetPurgeStatus request. The method always @@ -282,8 +364,7 @@ func (client WorkspacesClient) GetSchemaPreparer(ctx context.Context, resourceGr // GetSchemaSender sends the GetSchema request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) GetSchemaSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // GetSchemaResponder handles the response to the GetSchema request. The method always @@ -368,8 +449,7 @@ func (client WorkspacesClient) ListKeysPreparer(ctx context.Context, resourceGro // ListKeysSender sends the ListKeys request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListKeysSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListKeysResponder handles the response to the ListKeys request. The method always @@ -441,8 +521,7 @@ func (client WorkspacesClient) ListLinkTargetsPreparer(ctx context.Context) (*ht // ListLinkTargetsSender sends the ListLinkTargets request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) ListLinkTargetsSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // ListLinkTargetsResponder handles the response to the ListLinkTargets request. The method always @@ -537,8 +616,7 @@ func (client WorkspacesClient) PurgePreparer(ctx context.Context, resourceGroupN // PurgeSender sends the Purge request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) PurgeSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // PurgeResponder handles the response to the Purge request. The method always @@ -623,8 +701,7 @@ func (client WorkspacesClient) RegenerateSharedKeysPreparer(ctx context.Context, // RegenerateSharedKeysSender sends the RegenerateSharedKeys request. The method will close the // http.Response Body if it receives an error. func (client WorkspacesClient) RegenerateSharedKeysSender(req *http.Request) (*http.Response, error) { - sd := autorest.GetSendDecorators(req.Context(), azure.DoRetryWithRegistration(client.Client)) - return autorest.SendWithSender(client, req, sd...) + return client.Send(req, azure.DoRetryWithRegistration(client.Client)) } // RegenerateSharedKeysResponder handles the response to the RegenerateSharedKeys request. The method always