diff --git a/services/appinsights/mgmt/2015-05-01/insights/annotations.go b/services/appinsights/mgmt/2015-05-01/insights/annotations.go index 93f5b3e468a6..c6b16adb42e8 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/annotations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/annotations.go @@ -30,13 +30,13 @@ type AnnotationsClient struct { } // NewAnnotationsClient creates an instance of the AnnotationsClient client. -func NewAnnotationsClient(subscriptionID string, purgeID string) AnnotationsClient { - return NewAnnotationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewAnnotationsClient(subscriptionID string) AnnotationsClient { + return NewAnnotationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewAnnotationsClientWithBaseURI creates an instance of the AnnotationsClient client. -func NewAnnotationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) AnnotationsClient { - return AnnotationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewAnnotationsClientWithBaseURI(baseURI string, subscriptionID string) AnnotationsClient { + return AnnotationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create create an Annotation of an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go index 8253ecf52c14..832dfaf7f107 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/apikeys.go +++ b/services/appinsights/mgmt/2015-05-01/insights/apikeys.go @@ -30,13 +30,13 @@ type APIKeysClient struct { } // NewAPIKeysClient creates an instance of the APIKeysClient client. -func NewAPIKeysClient(subscriptionID string, purgeID string) APIKeysClient { - return NewAPIKeysClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewAPIKeysClient(subscriptionID string) APIKeysClient { + return NewAPIKeysClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewAPIKeysClientWithBaseURI creates an instance of the APIKeysClient client. -func NewAPIKeysClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) APIKeysClient { - return APIKeysClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewAPIKeysClientWithBaseURI(baseURI string, subscriptionID string) APIKeysClient { + return APIKeysClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create create an API Key of an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/client.go b/services/appinsights/mgmt/2015-05-01/insights/client.go index 19398ab010e7..8508d449fead 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/client.go +++ b/services/appinsights/mgmt/2015-05-01/insights/client.go @@ -34,20 +34,18 @@ type BaseClient struct { autorest.Client BaseURI string SubscriptionID string - PurgeID string } // New creates an instance of the BaseClient client. -func New(subscriptionID string, purgeID string) BaseClient { - return NewWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func New(subscriptionID string) BaseClient { + return NewWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWithBaseURI creates an instance of the BaseClient client. -func NewWithBaseURI(baseURI string, subscriptionID string, purgeID string) BaseClient { +func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { return BaseClient{ Client: autorest.NewClientWithUserAgent(UserAgent()), BaseURI: baseURI, SubscriptionID: subscriptionID, - PurgeID: purgeID, } } diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go index 3c7929da2716..2e7d7b4c9733 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentavailablefeatures.go @@ -30,13 +30,13 @@ type ComponentAvailableFeaturesClient struct { } // NewComponentAvailableFeaturesClient creates an instance of the ComponentAvailableFeaturesClient client. -func NewComponentAvailableFeaturesClient(subscriptionID string, purgeID string) ComponentAvailableFeaturesClient { - return NewComponentAvailableFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewComponentAvailableFeaturesClient(subscriptionID string) ComponentAvailableFeaturesClient { + return NewComponentAvailableFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewComponentAvailableFeaturesClientWithBaseURI creates an instance of the ComponentAvailableFeaturesClient client. -func NewComponentAvailableFeaturesClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ComponentAvailableFeaturesClient { - return ComponentAvailableFeaturesClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewComponentAvailableFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentAvailableFeaturesClient { + return ComponentAvailableFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get returns all available features of the application insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go index 5dd24d2265f9..55678b16ce99 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentcurrentbillingfeatures.go @@ -30,14 +30,14 @@ type ComponentCurrentBillingFeaturesClient struct { } // NewComponentCurrentBillingFeaturesClient creates an instance of the ComponentCurrentBillingFeaturesClient client. -func NewComponentCurrentBillingFeaturesClient(subscriptionID string, purgeID string) ComponentCurrentBillingFeaturesClient { - return NewComponentCurrentBillingFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewComponentCurrentBillingFeaturesClient(subscriptionID string) ComponentCurrentBillingFeaturesClient { + return NewComponentCurrentBillingFeaturesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewComponentCurrentBillingFeaturesClientWithBaseURI creates an instance of the ComponentCurrentBillingFeaturesClient // client. -func NewComponentCurrentBillingFeaturesClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ComponentCurrentBillingFeaturesClient { - return ComponentCurrentBillingFeaturesClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewComponentCurrentBillingFeaturesClientWithBaseURI(baseURI string, subscriptionID string) ComponentCurrentBillingFeaturesClient { + return ComponentCurrentBillingFeaturesClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get returns current billing features for an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go index 99b716a3aa2b..78a56cdd44b2 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentfeaturecapabilities.go @@ -30,14 +30,14 @@ type ComponentFeatureCapabilitiesClient struct { } // NewComponentFeatureCapabilitiesClient creates an instance of the ComponentFeatureCapabilitiesClient client. -func NewComponentFeatureCapabilitiesClient(subscriptionID string, purgeID string) ComponentFeatureCapabilitiesClient { - return NewComponentFeatureCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewComponentFeatureCapabilitiesClient(subscriptionID string) ComponentFeatureCapabilitiesClient { + return NewComponentFeatureCapabilitiesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewComponentFeatureCapabilitiesClientWithBaseURI creates an instance of the ComponentFeatureCapabilitiesClient // client. -func NewComponentFeatureCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ComponentFeatureCapabilitiesClient { - return ComponentFeatureCapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewComponentFeatureCapabilitiesClientWithBaseURI(baseURI string, subscriptionID string) ComponentFeatureCapabilitiesClient { + return ComponentFeatureCapabilitiesClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get returns feature capabilites of the application insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go index e506c693d174..991b6d4bc255 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go +++ b/services/appinsights/mgmt/2015-05-01/insights/componentquotastatus.go @@ -30,13 +30,13 @@ type ComponentQuotaStatusClient struct { } // NewComponentQuotaStatusClient creates an instance of the ComponentQuotaStatusClient client. -func NewComponentQuotaStatusClient(subscriptionID string, purgeID string) ComponentQuotaStatusClient { - return NewComponentQuotaStatusClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewComponentQuotaStatusClient(subscriptionID string) ComponentQuotaStatusClient { + return NewComponentQuotaStatusClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewComponentQuotaStatusClientWithBaseURI creates an instance of the ComponentQuotaStatusClient client. -func NewComponentQuotaStatusClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ComponentQuotaStatusClient { - return ComponentQuotaStatusClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewComponentQuotaStatusClientWithBaseURI(baseURI string, subscriptionID string) ComponentQuotaStatusClient { + return ComponentQuotaStatusClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get returns daily data volume cap (quota) status for an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/components.go b/services/appinsights/mgmt/2015-05-01/insights/components.go index ff0fcb09c95e..b403b928518b 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/components.go +++ b/services/appinsights/mgmt/2015-05-01/insights/components.go @@ -31,13 +31,13 @@ type ComponentsClient struct { } // NewComponentsClient creates an instance of the ComponentsClient client. -func NewComponentsClient(subscriptionID string, purgeID string) ComponentsClient { - return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewComponentsClient(subscriptionID string) ComponentsClient { + return NewComponentsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewComponentsClientWithBaseURI creates an instance of the ComponentsClient client. -func NewComponentsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ComponentsClient { - return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewComponentsClientWithBaseURI(baseURI string, subscriptionID string) ComponentsClient { + return ComponentsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate creates (or updates) an Application Insights component. Note: You cannot specify a different value @@ -254,9 +254,10 @@ func (client ComponentsClient) GetResponder(resp *http.Response) (result Applica // request. // // resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights -// component resource. -func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string) (result ComponentPurgeStatusResponse, err error) { - req, err := client.GetPurgeStatusPreparer(ctx, resourceGroupName, resourceName) +// component resource. purgeID is in a purge status request, this is the Id of the operation the status of which is +// returned. +func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (result ComponentPurgeStatusResponse, err error) { + req, err := client.GetPurgeStatusPreparer(ctx, resourceGroupName, resourceName, purgeID) if err != nil { err = autorest.NewErrorWithError(err, "insights.ComponentsClient", "GetPurgeStatus", nil, "Failure preparing request") return @@ -278,9 +279,9 @@ func (client ComponentsClient) GetPurgeStatus(ctx context.Context, resourceGroup } // GetPurgeStatusPreparer prepares the GetPurgeStatus request. -func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) { +func (client ComponentsClient) GetPurgeStatusPreparer(ctx context.Context, resourceGroupName string, resourceName string, purgeID string) (*http.Request, error) { pathParameters := map[string]interface{}{ - "purgeId": autorest.Encode("path", client.PurgeID), + "purgeId": autorest.Encode("path", purgeID), "resourceGroupName": autorest.Encode("path", resourceGroupName), "resourceName": autorest.Encode("path", resourceName), "subscriptionId": autorest.Encode("path", client.SubscriptionID), diff --git a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go index 45851f246a2b..c76a488ca74d 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/exportconfigurations.go @@ -30,13 +30,13 @@ type ExportConfigurationsClient struct { } // NewExportConfigurationsClient creates an instance of the ExportConfigurationsClient client. -func NewExportConfigurationsClient(subscriptionID string, purgeID string) ExportConfigurationsClient { - return NewExportConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewExportConfigurationsClient(subscriptionID string) ExportConfigurationsClient { + return NewExportConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewExportConfigurationsClientWithBaseURI creates an instance of the ExportConfigurationsClient client. -func NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ExportConfigurationsClient { - return ExportConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewExportConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ExportConfigurationsClient { + return ExportConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create create a Continuous Export configuration of an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorite.go b/services/appinsights/mgmt/2015-05-01/insights/favorite.go index a6aff501078c..c18bef50305f 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorite.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorite.go @@ -30,13 +30,13 @@ type FavoriteClient struct { } // NewFavoriteClient creates an instance of the FavoriteClient client. -func NewFavoriteClient(subscriptionID string, purgeID string) FavoriteClient { - return NewFavoriteClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewFavoriteClient(subscriptionID string) FavoriteClient { + return NewFavoriteClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewFavoriteClientWithBaseURI creates an instance of the FavoriteClient client. -func NewFavoriteClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) FavoriteClient { - return FavoriteClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewFavoriteClientWithBaseURI(baseURI string, subscriptionID string) FavoriteClient { + return FavoriteClient{NewWithBaseURI(baseURI, subscriptionID)} } // Add adds a new favorites to an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/favorites.go b/services/appinsights/mgmt/2015-05-01/insights/favorites.go index cdeb9763fc2f..119f18af713a 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/favorites.go +++ b/services/appinsights/mgmt/2015-05-01/insights/favorites.go @@ -30,13 +30,13 @@ type FavoritesClient struct { } // NewFavoritesClient creates an instance of the FavoritesClient client. -func NewFavoritesClient(subscriptionID string, purgeID string) FavoritesClient { - return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewFavoritesClient(subscriptionID string) FavoritesClient { + return NewFavoritesClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewFavoritesClientWithBaseURI creates an instance of the FavoritesClient client. -func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) FavoritesClient { - return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewFavoritesClientWithBaseURI(baseURI string, subscriptionID string) FavoritesClient { + return FavoritesClient{NewWithBaseURI(baseURI, subscriptionID)} } // List gets a list of favorites defined within an Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/models.go b/services/appinsights/mgmt/2015-05-01/insights/models.go index 99026d27bb3b..fef07bf45732 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/models.go +++ b/services/appinsights/mgmt/2015-05-01/insights/models.go @@ -40,6 +40,25 @@ func PossibleApplicationTypeValues() []ApplicationType { return []ApplicationType{Other, Web} } +// CategoryType enumerates the values for category type. +type CategoryType string + +const ( + // CategoryTypePerformance ... + CategoryTypePerformance CategoryType = "performance" + // CategoryTypeRetention ... + CategoryTypeRetention CategoryType = "retention" + // CategoryTypeTSG ... + CategoryTypeTSG CategoryType = "TSG" + // CategoryTypeWorkbook ... + CategoryTypeWorkbook CategoryType = "workbook" +) + +// PossibleCategoryTypeValues returns an array of possible values for the CategoryType const type. +func PossibleCategoryTypeValues() []CategoryType { + return []CategoryType{CategoryTypePerformance, CategoryTypeRetention, CategoryTypeTSG, CategoryTypeWorkbook} +} + // FavoriteSourceType enumerates the values for favorite source type. type FavoriteSourceType string @@ -123,6 +142,21 @@ func PossibleRequestSourceValues() []RequestSource { return []RequestSource{Rest} } +// SharedTypeKind enumerates the values for shared type kind. +type SharedTypeKind string + +const ( + // SharedTypeKindShared ... + SharedTypeKindShared SharedTypeKind = "shared" + // SharedTypeKindUser ... + SharedTypeKindUser SharedTypeKind = "user" +) + +// PossibleSharedTypeKindValues returns an array of possible values for the SharedTypeKind const type. +func PossibleSharedTypeKindValues() []SharedTypeKind { + return []SharedTypeKind{SharedTypeKindShared, SharedTypeKindUser} +} + // WebTestKind enumerates the values for web test kind. type WebTestKind string @@ -751,6 +785,16 @@ type ComponentPurgeStatusResponse struct { Status PurgeState `json:"status,omitempty"` } +// ErrorFieldContract error Field contract. +type ErrorFieldContract struct { + // Code - Property level error code. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of property-level error. + Message *string `json:"message,omitempty"` + // Target - Property name. + Target *string `json:"target,omitempty"` +} + // ErrorResponse error reponse indicates Insights service is not able to process the incoming request. The reason // is provided in the error message. type ErrorResponse struct { @@ -768,6 +812,16 @@ type InnerError struct { Time *date.Time `json:"time,omitempty"` } +// LinkProperties contains a sourceId and workbook resource id to link two resources. +type LinkProperties struct { + // SourceID - The source Azure resource id + SourceID *string `json:"sourceId,omitempty"` + // TargetID - The workbook Azure resource id + TargetID *string `json:"targetId,omitempty"` + // Category - The category of workbook + Category *string `json:"category,omitempty"` +} + // ListAnnotation ... type ListAnnotation struct { autorest.Response `json:"-"` @@ -792,6 +846,12 @@ type ListApplicationInsightsComponentProactiveDetectionConfiguration struct { Value *[]ApplicationInsightsComponentProactiveDetectionConfiguration `json:"value,omitempty"` } +// ListWorkbook ... +type ListWorkbook struct { + autorest.Response `json:"-"` + Value *[]Workbook `json:"value,omitempty"` +} + // ListWorkItemConfiguration ... type ListWorkItemConfiguration struct { autorest.Response `json:"-"` @@ -1241,6 +1301,171 @@ type WebTestPropertiesConfiguration struct { WebTest *string `json:"WebTest,omitempty"` } +// Workbook an Application Insights workbook definition. +type Workbook struct { + autorest.Response `json:"-"` + // Kind - The kind of workbook. Choices are user and shared. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + Kind SharedTypeKind `json:"kind,omitempty"` + // WorkbookProperties - Metadata describing a web test for an Azure resource. + *WorkbookProperties `json:"properties,omitempty"` + // ID - Azure resource Id + ID *string `json:"id,omitempty"` + // Name - Azure resource name + Name *string `json:"name,omitempty"` + // Type - Azure resource type + Type *string `json:"type,omitempty"` + // Location - Resource location + Location *string `json:"location,omitempty"` + // Tags - Resource tags + Tags map[string]*string `json:"tags"` +} + +// MarshalJSON is the custom marshaler for Workbook. +func (w Workbook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if w.Kind != "" { + objectMap["kind"] = w.Kind + } + if w.WorkbookProperties != nil { + objectMap["properties"] = w.WorkbookProperties + } + if w.ID != nil { + objectMap["id"] = w.ID + } + if w.Name != nil { + objectMap["name"] = w.Name + } + if w.Type != nil { + objectMap["type"] = w.Type + } + if w.Location != nil { + objectMap["location"] = w.Location + } + if w.Tags != nil { + objectMap["tags"] = w.Tags + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Workbook struct. +func (w *Workbook) 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 "kind": + if v != nil { + var kind SharedTypeKind + err = json.Unmarshal(*v, &kind) + if err != nil { + return err + } + w.Kind = kind + } + case "properties": + if v != nil { + var workbookProperties WorkbookProperties + err = json.Unmarshal(*v, &workbookProperties) + if err != nil { + return err + } + w.WorkbookProperties = &workbookProperties + } + 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 + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + w.Location = &location + } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + w.Tags = tags + } + } + } + + return nil +} + +// WorkbookError error message body that will indicate why the operation failed. +type WorkbookError struct { + // Code - Service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + Code *string `json:"code,omitempty"` + // Message - Human-readable representation of the error. + Message *string `json:"message,omitempty"` + // Details - The list of invalid fields send in request, in case of validation error. + Details *[]ErrorFieldContract `json:"details,omitempty"` +} + +// WorkbookProperties properties that contain a workbook. +type WorkbookProperties struct { + // Name - The user-defined name of the workbook. + Name *string `json:"name,omitempty"` + // SerializedData - Configuration of this particular workbook. Configuration data is a string containing valid JSON + SerializedData *string `json:"serializedData,omitempty"` + // Version - This instance's version of the data model. This can change as new features are added that can be marked workbook. + Version *string `json:"version,omitempty"` + // WorkbookID - Internally assigned unique id of the workbook definition. + WorkbookID *string `json:"workbookId,omitempty"` + // SharedTypeKind - Enum indicating if this workbook definition is owned by a specific user or is shared between all users with access to the Application Insights component. Possible values include: 'SharedTypeKindUser', 'SharedTypeKindShared' + SharedTypeKind SharedTypeKind `json:"kind,omitempty"` + // TimeModified - Date and time in UTC of the last modification that was made to this workbook definition. + TimeModified *string `json:"timeModified,omitempty"` + // Category - Workbook category, as defined by the user at creation time. + Category *string `json:"category,omitempty"` + // Tags - A list of 0 or more tags that are associated with this workbook definition + Tags *[]string `json:"tags,omitempty"` + // UserID - Unique user id of the specific user that owns this workbook. + UserID *string `json:"userId,omitempty"` + // SourceResourceID - Optional resourceId for a source resource. + SourceResourceID *string `json:"sourceResourceId,omitempty"` +} + +// Workbooks workbook list result. +type Workbooks struct { + autorest.Response `json:"-"` + // Value - An array of workbooks. + Value *[]Workbook `json:"value,omitempty"` +} + // WorkItemConfiguration work item configuration associated with an application insights resource. type WorkItemConfiguration struct { autorest.Response `json:"-"` diff --git a/services/appinsights/mgmt/2015-05-01/insights/operations.go b/services/appinsights/mgmt/2015-05-01/insights/operations.go index 1a59a7fd677e..a06822f91600 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/operations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/operations.go @@ -30,13 +30,13 @@ type OperationsClient struct { } // NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string, purgeID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewOperationsClient(subscriptionID string) OperationsClient { + return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewOperationsClientWithBaseURI creates an instance of the OperationsClient client. -func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { + return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List lists all of the available insights REST API operations. diff --git a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go index b746475b8920..00b8a1aa812b 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/proactivedetectionconfigurations.go @@ -30,14 +30,14 @@ type ProactiveDetectionConfigurationsClient struct { } // NewProactiveDetectionConfigurationsClient creates an instance of the ProactiveDetectionConfigurationsClient client. -func NewProactiveDetectionConfigurationsClient(subscriptionID string, purgeID string) ProactiveDetectionConfigurationsClient { - return NewProactiveDetectionConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewProactiveDetectionConfigurationsClient(subscriptionID string) ProactiveDetectionConfigurationsClient { + return NewProactiveDetectionConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewProactiveDetectionConfigurationsClientWithBaseURI creates an instance of the // ProactiveDetectionConfigurationsClient client. -func NewProactiveDetectionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) ProactiveDetectionConfigurationsClient { - return ProactiveDetectionConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewProactiveDetectionConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) ProactiveDetectionConfigurationsClient { + return ProactiveDetectionConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Get get the ProactiveDetection configuration for this configuration id. diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go index da0a7435ea0c..5f865462c81e 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtestlocations.go @@ -30,13 +30,13 @@ type WebTestLocationsClient struct { } // NewWebTestLocationsClient creates an instance of the WebTestLocationsClient client. -func NewWebTestLocationsClient(subscriptionID string, purgeID string) WebTestLocationsClient { - return NewWebTestLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewWebTestLocationsClient(subscriptionID string) WebTestLocationsClient { + return NewWebTestLocationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWebTestLocationsClientWithBaseURI creates an instance of the WebTestLocationsClient client. -func NewWebTestLocationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) WebTestLocationsClient { - return WebTestLocationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewWebTestLocationsClientWithBaseURI(baseURI string, subscriptionID string) WebTestLocationsClient { + return WebTestLocationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // List gets a list of web test locations available to this Application Insights component. diff --git a/services/appinsights/mgmt/2015-05-01/insights/webtests.go b/services/appinsights/mgmt/2015-05-01/insights/webtests.go index 961991cb0a38..5d8de80ebddf 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/webtests.go +++ b/services/appinsights/mgmt/2015-05-01/insights/webtests.go @@ -31,13 +31,13 @@ type WebTestsClient struct { } // NewWebTestsClient creates an instance of the WebTestsClient client. -func NewWebTestsClient(subscriptionID string, purgeID string) WebTestsClient { - return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewWebTestsClient(subscriptionID string) WebTestsClient { + return NewWebTestsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWebTestsClientWithBaseURI creates an instance of the WebTestsClient client. -func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) WebTestsClient { - return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewWebTestsClientWithBaseURI(baseURI string, subscriptionID string) WebTestsClient { + return WebTestsClient{NewWithBaseURI(baseURI, subscriptionID)} } // CreateOrUpdate creates or updates an Application Insights web test definition. diff --git a/services/appinsights/mgmt/2015-05-01/insights/workbook.go b/services/appinsights/mgmt/2015-05-01/insights/workbook.go new file mode 100644 index 000000000000..e2822bc46b93 --- /dev/null +++ b/services/appinsights/mgmt/2015-05-01/insights/workbook.go @@ -0,0 +1,399 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/validation" + "net/http" +) + +// WorkbookClient is the composite Swagger for Application Insights Management Client +type WorkbookClient struct { + BaseClient +} + +// NewWorkbookClient creates an instance of the WorkbookClient client. +func NewWorkbookClient(subscriptionID string) WorkbookClient { + return NewWorkbookClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkbookClientWithBaseURI creates an instance of the WorkbookClient client. +func NewWorkbookClientWithBaseURI(baseURI string, subscriptionID string) WorkbookClient { + return WorkbookClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// CreateOrUpdate create a new workbook. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. workbookProperties is properties that need to be specified to create a new workbook. +func (client WorkbookClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { + if err := validation.Validate([]validation.Validation{ + {TargetValue: workbookProperties, + Constraints: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties", Name: validation.Null, Rule: false, + Chain: []validation.Constraint{{Target: "workbookProperties.WorkbookProperties.Name", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.SerializedData", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.WorkbookID", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.Category", Name: validation.Null, Rule: true, Chain: nil}, + {Target: "workbookProperties.WorkbookProperties.UserID", Name: validation.Null, Rule: true, Chain: nil}, + }}}}}); err != nil { + return result, validation.NewError("insights.WorkbookClient", "CreateOrUpdate", err.Error()) + } + + req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + resp, err := client.CreateOrUpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "CreateOrUpdate", resp, "Failure sending request") + return + } + + result, err = client.CreateOrUpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "CreateOrUpdate", resp, "Failure responding to request") + } + + return +} + +// CreateOrUpdatePreparer prepares the CreateOrUpdate request. +func (client WorkbookClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + 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 WorkbookClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always +// closes the http.Response Body. +func (client WorkbookClient) CreateOrUpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Delete delete a workbook. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. location is the name of location where workbook is stored. +func (client WorkbookClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, location string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client WorkbookClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "location": autorest.Encode("query", location), + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbookClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client WorkbookClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusNoContent), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get get a single workbook by its resourceName. +// +// resourceName is the name of the Application Insights component resource. location is the name of location where +// workbook is stored. +func (client WorkbookClient) Get(ctx context.Context, resourceName string, location string) (result Workbook, err error) { + req, err := client.GetPreparer(ctx, resourceName, location) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client WorkbookClient) GetPreparer(ctx context.Context, resourceName string, location string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "location": autorest.Encode("query", location), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/workbooks/{resourceName}", 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 WorkbookClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client WorkbookClient) GetResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets a list of workbooks by sourceId. +// +// sourceID is azure Resource Id that will fetch all linked workbooks. category is category of workbook to return. +// tags is tags presents on each workbook returned. canFetchContent is flag indicating whether or not to return the +// full content for each applicable workbook. If false, only return summary content for workbooks. +func (client WorkbookClient) List(ctx context.Context, sourceID string, category CategoryType, tags []string, canFetchContent *bool) (result ListWorkbook, err error) { + req, err := client.ListPreparer(ctx, sourceID, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client WorkbookClient) ListPreparer(ctx context.Context, sourceID string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + "sourceId": autorest.Encode("query", sourceID), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/microsoft.insights/workbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbookClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client WorkbookClient) ListResponder(resp *http.Response) (result ListWorkbook, 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 +} + +// Update updates a workbook that has already been added. +// +// resourceGroupName is the name of the resource group. resourceName is the name of the Application Insights +// component resource. workbookProperties is properties that need to be specified to create a new workbook. +func (client WorkbookClient) Update(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (result Workbook, err error) { + req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, workbookProperties) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Update", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Update", resp, "Failure sending request") + return + } + + result, err = client.UpdateResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbookClient", "Update", resp, "Failure responding to request") + } + + return +} + +// UpdatePreparer prepares the Update request. +func (client WorkbookClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, workbookProperties Workbook) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "resourceName": autorest.Encode("path", resourceName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks/{resourceName}", pathParameters), + autorest.WithJSON(workbookProperties), + 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 WorkbookClient) UpdateSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// UpdateResponder handles the response to the Update request. The method always +// closes the http.Response Body. +func (client WorkbookClient) UpdateResponder(resp *http.Response) (result Workbook, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appinsights/mgmt/2015-05-01/insights/workbooks.go b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go new file mode 100644 index 000000000000..ec80df0038f6 --- /dev/null +++ b/services/appinsights/mgmt/2015-05-01/insights/workbooks.go @@ -0,0 +1,116 @@ +package insights + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// WorkbooksClient is the composite Swagger for Application Insights Management Client +type WorkbooksClient struct { + BaseClient +} + +// NewWorkbooksClient creates an instance of the WorkbooksClient client. +func NewWorkbooksClient(subscriptionID string) WorkbooksClient { + return NewWorkbooksClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewWorkbooksClientWithBaseURI creates an instance of the WorkbooksClient client. +func NewWorkbooksClientWithBaseURI(baseURI string, subscriptionID string) WorkbooksClient { + return WorkbooksClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByResourceGroup get all Workbooks defined within a specified resource group and category. +// +// resourceGroupName is the name of the resource group. location is the name of location where workbook is stored. +// category is category of workbook to return. tags is tags presents on each workbook returned. canFetchContent is +// flag indicating whether or not to return the full content for each applicable workbook. If false, only return +// summary content for workbooks. +func (client WorkbooksClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, location string, category CategoryType, tags []string, canFetchContent *bool) (result Workbooks, err error) { + req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, location, category, tags, canFetchContent) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", nil, "Failure preparing request") + return + } + + resp, err := client.ListByResourceGroupSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure sending request") + return + } + + result, err = client.ListByResourceGroupResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "insights.WorkbooksClient", "ListByResourceGroup", resp, "Failure responding to request") + } + + return +} + +// ListByResourceGroupPreparer prepares the ListByResourceGroup request. +func (client WorkbooksClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, location string, category CategoryType, tags []string, canFetchContent *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "resourceGroupName": autorest.Encode("path", resourceGroupName), + "subscriptionId": autorest.Encode("path", client.SubscriptionID), + } + + const APIVersion = "2015-05-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "category": autorest.Encode("query", category), + "location": autorest.Encode("query", location), + } + if tags != nil && len(tags) > 0 { + queryParameters["tags"] = autorest.Encode("query", tags, ",") + } + if canFetchContent != nil { + queryParameters["canFetchContent"] = autorest.Encode("query", *canFetchContent) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroup/{resourceGroupName}/providers/microsoft.insights/workbooks", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the +// http.Response Body if it receives an error. +func (client WorkbooksClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + azure.DoRetryWithRegistration(client.Client)) +} + +// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always +// closes the http.Response Body. +func (client WorkbooksClient) ListByResourceGroupResponder(resp *http.Response) (result Workbooks, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go index 8c7807f77543..4b05a66cd462 100644 --- a/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go +++ b/services/appinsights/mgmt/2015-05-01/insights/workitemconfigurations.go @@ -30,13 +30,13 @@ type WorkItemConfigurationsClient struct { } // NewWorkItemConfigurationsClient creates an instance of the WorkItemConfigurationsClient client. -func NewWorkItemConfigurationsClient(subscriptionID string, purgeID string) WorkItemConfigurationsClient { - return NewWorkItemConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID, purgeID) +func NewWorkItemConfigurationsClient(subscriptionID string) WorkItemConfigurationsClient { + return NewWorkItemConfigurationsClientWithBaseURI(DefaultBaseURI, subscriptionID) } // NewWorkItemConfigurationsClientWithBaseURI creates an instance of the WorkItemConfigurationsClient client. -func NewWorkItemConfigurationsClientWithBaseURI(baseURI string, subscriptionID string, purgeID string) WorkItemConfigurationsClient { - return WorkItemConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID, purgeID)} +func NewWorkItemConfigurationsClientWithBaseURI(baseURI string, subscriptionID string) WorkItemConfigurationsClient { + return WorkItemConfigurationsClient{NewWithBaseURI(baseURI, subscriptionID)} } // Create create a work item configuration for an Application Insights component.