vendor: add github.com/Azure/azure-sdk-for-go and dependencies
This commit is contained in:
+53
@@ -0,0 +1,53 @@
|
||||
// Package servicemap implements the Azure ARM Servicemap service API version
|
||||
// 2015-11-01-preview.
|
||||
//
|
||||
// Service Map API Reference
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
)
|
||||
|
||||
const (
|
||||
// DefaultBaseURI is the default URI used for the service Servicemap
|
||||
DefaultBaseURI = "https://management.azure.com"
|
||||
)
|
||||
|
||||
// ManagementClient is the base client for Servicemap.
|
||||
type ManagementClient struct {
|
||||
autorest.Client
|
||||
BaseURI string
|
||||
SubscriptionID string
|
||||
}
|
||||
|
||||
// New creates an instance of the ManagementClient client.
|
||||
func New(subscriptionID string) ManagementClient {
|
||||
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewWithBaseURI creates an instance of the ManagementClient client.
|
||||
func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
|
||||
return ManagementClient{
|
||||
Client: autorest.NewClientWithUserAgent(UserAgent()),
|
||||
BaseURI: baseURI,
|
||||
SubscriptionID: subscriptionID,
|
||||
}
|
||||
}
|
||||
Generated
Vendored
Executable
+357
@@ -0,0 +1,357 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ClientGroupsClient is the service Map API Reference
|
||||
type ClientGroupsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewClientGroupsClient creates an instance of the ClientGroupsClient client.
|
||||
func NewClientGroupsClient(subscriptionID string) ClientGroupsClient {
|
||||
return NewClientGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewClientGroupsClientWithBaseURI creates an instance of the
|
||||
// ClientGroupsClient client.
|
||||
func NewClientGroupsClientWithBaseURI(baseURI string, subscriptionID string) ClientGroupsClient {
|
||||
return ClientGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get retrieves the specified client group
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. clientGroupName is client Group resource name. startTime is uTC
|
||||
// date and time specifying the start time of an interval. When not specified
|
||||
// the service uses DateTime.UtcNow - 10m endTime is uTC date and time
|
||||
// specifying the end time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow
|
||||
func (client ClientGroupsClient) Get(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (result ClientGroup, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: clientGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil},
|
||||
{Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ClientGroupsClient) GetPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"clientGroupName": autorest.Encode("path", clientGroupName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ClientGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ClientGroupsClient) GetResponder(resp *http.Response) (result ClientGroup, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetMembersCount returns the approximate number of members in the client
|
||||
// group.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. clientGroupName is client Group resource name. startTime is uTC
|
||||
// date and time specifying the start time of an interval. When not specified
|
||||
// the service uses DateTime.UtcNow - 10m endTime is uTC date and time
|
||||
// specifying the end time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow
|
||||
func (client ClientGroupsClient) GetMembersCount(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (result ClientGroupMembersCount, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: clientGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil},
|
||||
{Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "GetMembersCount")
|
||||
}
|
||||
|
||||
req, err := client.GetMembersCountPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetMembersCountSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetMembersCountResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "GetMembersCount", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetMembersCountPreparer prepares the GetMembersCount request.
|
||||
func (client ClientGroupsClient) GetMembersCountPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"clientGroupName": autorest.Encode("path", clientGroupName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/membersCount", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetMembersCountSender sends the GetMembersCount request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ClientGroupsClient) GetMembersCountSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetMembersCountResponder handles the response to the GetMembersCount request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ClientGroupsClient) GetMembersCountResponder(resp *http.Response) (result ClientGroupMembersCount, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMembers returns the members of the client group during the specified
|
||||
// time interval.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. clientGroupName is client Group resource name. startTime is uTC
|
||||
// date and time specifying the start time of an interval. When not specified
|
||||
// the service uses DateTime.UtcNow - 10m endTime is uTC date and time
|
||||
// specifying the end time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow top is page size to use. When not specified, the default
|
||||
// page size is 100 records.
|
||||
func (client ClientGroupsClient) ListMembers(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time, top *int32) (result ClientGroupMembersCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: clientGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "clientGroupName", Name: validation.MaxLength, Rule: 256, Chain: nil},
|
||||
{Target: "clientGroupName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: top,
|
||||
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil},
|
||||
{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ClientGroupsClient", "ListMembers")
|
||||
}
|
||||
|
||||
req, err := client.ListMembersPreparer(resourceGroupName, workspaceName, clientGroupName, startTime, endTime, top)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMembersSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListMembersResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMembersPreparer prepares the ListMembers request.
|
||||
func (client ClientGroupsClient) ListMembersPreparer(resourceGroupName string, workspaceName string, clientGroupName string, startTime *date.Time, endTime *date.Time, top *int32) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"clientGroupName": autorest.Encode("path", clientGroupName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
if top != nil {
|
||||
queryParameters["$top"] = autorest.Encode("query", *top)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/clientGroups/{clientGroupName}/members", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListMembersSender sends the ListMembers request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ClientGroupsClient) ListMembersSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListMembersResponder handles the response to the ListMembers request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ClientGroupsClient) ListMembersResponder(resp *http.Response) (result ClientGroupMembersCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMembersNextResults retrieves the next set of results, if any.
|
||||
func (client ClientGroupsClient) ListMembersNextResults(lastResults ClientGroupMembersCollection) (result ClientGroupMembersCollection, err error) {
|
||||
req, err := lastResults.ClientGroupMembersCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMembersSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListMembersResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ClientGroupsClient", "ListMembers", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Generated
Vendored
Executable
+492
@@ -0,0 +1,492 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// MachineGroupsClient is the service Map API Reference
|
||||
type MachineGroupsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewMachineGroupsClient creates an instance of the MachineGroupsClient
|
||||
// client.
|
||||
func NewMachineGroupsClient(subscriptionID string) MachineGroupsClient {
|
||||
return NewMachineGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewMachineGroupsClientWithBaseURI creates an instance of the
|
||||
// MachineGroupsClient client.
|
||||
func NewMachineGroupsClientWithBaseURI(baseURI string, subscriptionID string) MachineGroupsClient {
|
||||
return MachineGroupsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Create creates a new machine group.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineGroup is machine Group resource to create.
|
||||
func (client MachineGroupsClient) Create(resourceGroupName string, workspaceName string, machineGroup MachineGroup) (result MachineGroup, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineGroup,
|
||||
Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil},
|
||||
{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
}},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Create")
|
||||
}
|
||||
|
||||
req, err := client.CreatePreparer(resourceGroupName, workspaceName, machineGroup)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.CreateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.CreateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Create", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// CreatePreparer prepares the Create request.
|
||||
func (client MachineGroupsClient) CreatePreparer(resourceGroupName string, workspaceName string, machineGroup MachineGroup) (*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-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups", pathParameters),
|
||||
autorest.WithJSON(machineGroup),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// CreateSender sends the Create request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachineGroupsClient) CreateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// CreateResponder handles the response to the Create request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachineGroupsClient) CreateResponder(resp *http.Response) (result MachineGroup, 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 deletes the specified Machine Group.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineGroupName is machine Group resource name.
|
||||
func (client MachineGroupsClient) Delete(resourceGroupName string, workspaceName string, machineGroupName string) (result autorest.Response, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil},
|
||||
{Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Delete")
|
||||
}
|
||||
|
||||
req, err := client.DeletePreparer(resourceGroupName, workspaceName, machineGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.DeleteSender(req)
|
||||
if err != nil {
|
||||
result.Response = resp
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.DeleteResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Delete", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// DeletePreparer prepares the Delete request.
|
||||
func (client MachineGroupsClient) DeletePreparer(resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineGroupName": autorest.Encode("path", machineGroupName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsDelete(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// DeleteSender sends the Delete request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachineGroupsClient) DeleteSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// DeleteResponder handles the response to the Delete request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachineGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
|
||||
autorest.ByClosing())
|
||||
result.Response = resp
|
||||
return
|
||||
}
|
||||
|
||||
// Get returns the specified machine group.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineGroupName is machine Group resource name.
|
||||
func (client MachineGroupsClient) Get(resourceGroupName string, workspaceName string, machineGroupName string) (result MachineGroup, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil},
|
||||
{Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName, machineGroupName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client MachineGroupsClient) GetPreparer(resourceGroupName string, workspaceName string, machineGroupName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineGroupName": autorest.Encode("path", machineGroupName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
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}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachineGroupsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachineGroupsClient) GetResponder(resp *http.Response) (result MachineGroup, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspace returns all machine groups.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest.
|
||||
func (client MachineGroupsClient) ListByWorkspace(resourceGroupName string, workspaceName string) (result MachineGroupCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "ListByWorkspace")
|
||||
}
|
||||
|
||||
req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByWorkspaceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByWorkspaceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspacePreparer prepares the ListByWorkspace request.
|
||||
func (client MachineGroupsClient) ListByWorkspacePreparer(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-11-01-preview"
|
||||
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}/features/serviceMap/machineGroups", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachineGroupsClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachineGroupsClient) ListByWorkspaceResponder(resp *http.Response) (result MachineGroupCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspaceNextResults retrieves the next set of results, if any.
|
||||
func (client MachineGroupsClient) ListByWorkspaceNextResults(lastResults MachineGroupCollection) (result MachineGroupCollection, err error) {
|
||||
req, err := lastResults.MachineGroupCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByWorkspaceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByWorkspaceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "ListByWorkspace", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// Update updates a machine group.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineGroupName is machine Group resource name. machineGroup is
|
||||
// machine Group resource to update.
|
||||
func (client MachineGroupsClient) Update(resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (result MachineGroup, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "machineGroupName", Name: validation.MaxLength, Rule: 36, Chain: nil},
|
||||
{Target: "machineGroupName", Name: validation.MinLength, Rule: 36, Chain: nil}}},
|
||||
{TargetValue: machineGroup,
|
||||
Constraints: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MaxLength, Rule: 256, Chain: nil},
|
||||
{Target: "machineGroup.MachineGroupProperties.DisplayName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
}},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachineGroupsClient", "Update")
|
||||
}
|
||||
|
||||
req, err := client.UpdatePreparer(resourceGroupName, workspaceName, machineGroupName, machineGroup)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.UpdateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.UpdateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachineGroupsClient", "Update", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// UpdatePreparer prepares the Update request.
|
||||
func (client MachineGroupsClient) UpdatePreparer(resourceGroupName string, workspaceName string, machineGroupName string, machineGroup MachineGroup) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineGroupName": autorest.Encode("path", machineGroupName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPut(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machineGroups/{machineGroupName}", pathParameters),
|
||||
autorest.WithJSON(machineGroup),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// UpdateSender sends the Update request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachineGroupsClient) UpdateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// UpdateResponder handles the response to the Update request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachineGroupsClient) UpdateResponder(resp *http.Response) (result MachineGroup, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+846
@@ -0,0 +1,846 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// MachinesClient is the service Map API Reference
|
||||
type MachinesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewMachinesClient creates an instance of the MachinesClient client.
|
||||
func NewMachinesClient(subscriptionID string) MachinesClient {
|
||||
return NewMachinesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewMachinesClientWithBaseURI creates an instance of the MachinesClient
|
||||
// client.
|
||||
func NewMachinesClientWithBaseURI(baseURI string, subscriptionID string) MachinesClient {
|
||||
return MachinesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get returns the specified machine.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. timestamp is uTC date and
|
||||
// time specifying a time instance relative to which to evaluate the machine
|
||||
// resource. When not specified, the service uses DateTime.UtcNow.
|
||||
func (client MachinesClient) Get(resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (result Machine, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, timestamp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client MachinesClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if timestamp != nil {
|
||||
queryParameters["timestamp"] = autorest.Encode("query", *timestamp)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) GetResponder(resp *http.Response) (result Machine, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetLiveness obtains the liveness status of the machine during the specified
|
||||
// time interval.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. startTime is uTC date and
|
||||
// time specifying the start time of an interval. When not specified the
|
||||
// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying
|
||||
// the end time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow
|
||||
func (client MachinesClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "GetLiveness")
|
||||
}
|
||||
|
||||
req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetLivenessSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetLivenessResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "GetLiveness", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetLivenessPreparer prepares the GetLiveness request.
|
||||
func (client MachinesClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/liveness", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetLivenessSender sends the GetLiveness request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) GetLivenessSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetLivenessResponder handles the response to the GetLiveness request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspace returns a collection of machines matching the specified
|
||||
// conditions. The returned collection represents either machines that are
|
||||
// active/live during the specified interval of time (`live=true` and
|
||||
// `startTime`/`endTime` are specified) or that are known to have existed at or
|
||||
// some time prior to the specified point in time (`live=false` and `timestamp`
|
||||
// is specified).
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. live is specifies whether to return live resources (true) or
|
||||
// inventory resources (false). Defaults to **true**. When retrieving live
|
||||
// resources, the start time (`startTime`) and end time (`endTime`) of the
|
||||
// desired interval should be included. When retrieving inventory resources, an
|
||||
// optional timestamp (`timestamp`) parameter can be specified to return the
|
||||
// version of each resource closest (not-after) that timestamp. startTime is
|
||||
// uTC date and time specifying the start time of an interval. When not
|
||||
// specified the service uses DateTime.UtcNow - 10m endTime is uTC date and
|
||||
// time specifying the end time of an interval. When not specified the service
|
||||
// uses DateTime.UtcNow timestamp is uTC date and time specifying a time
|
||||
// instance relative to which to evaluate each machine resource. Only applies
|
||||
// when `live=false`. When not specified, the service uses DateTime.UtcNow. top
|
||||
// is page size to use. When not specified, the default page size is 100
|
||||
// records.
|
||||
func (client MachinesClient) ListByWorkspace(resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (result MachineCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: top,
|
||||
Constraints: []validation.Constraint{{Target: "top", Name: validation.Null, Rule: false,
|
||||
Chain: []validation.Constraint{{Target: "top", Name: validation.InclusiveMaximum, Rule: 200, Chain: nil},
|
||||
{Target: "top", Name: validation.InclusiveMinimum, Rule: 1, Chain: nil},
|
||||
}}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListByWorkspace")
|
||||
}
|
||||
|
||||
req, err := client.ListByWorkspacePreparer(resourceGroupName, workspaceName, live, startTime, endTime, timestamp, top)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByWorkspaceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListByWorkspaceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspacePreparer prepares the ListByWorkspace request.
|
||||
func (client MachinesClient) ListByWorkspacePreparer(resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (*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-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if live != nil {
|
||||
queryParameters["live"] = autorest.Encode("query", *live)
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
if timestamp != nil {
|
||||
queryParameters["timestamp"] = autorest.Encode("query", *timestamp)
|
||||
}
|
||||
if top != nil {
|
||||
queryParameters["$top"] = autorest.Encode("query", *top)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListByWorkspaceSender sends the ListByWorkspace request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) ListByWorkspaceSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListByWorkspaceResponder handles the response to the ListByWorkspace request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) ListByWorkspaceResponder(resp *http.Response) (result MachineCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListByWorkspaceNextResults retrieves the next set of results, if any.
|
||||
func (client MachinesClient) ListByWorkspaceNextResults(lastResults MachineCollection) (result MachineCollection, err error) {
|
||||
req, err := lastResults.MachineCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListByWorkspaceSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListByWorkspaceResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnections returns a collection of connections terminating or
|
||||
// originating at the specified machine
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. startTime is uTC date and
|
||||
// time specifying the start time of an interval. When not specified the
|
||||
// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying
|
||||
// the end time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow
|
||||
func (client MachinesClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListConnections")
|
||||
}
|
||||
|
||||
req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListConnectionsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListConnectionsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnectionsPreparer prepares the ListConnections request.
|
||||
func (client MachinesClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/connections", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListConnectionsSender sends the ListConnections request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) ListConnectionsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListConnectionsResponder handles the response to the ListConnections request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnectionsNextResults retrieves the next set of results, if any.
|
||||
func (client MachinesClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) {
|
||||
req, err := lastResults.ConnectionCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListConnectionsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListConnectionsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMachineGroupMembership returns a collection of machine groups this
|
||||
// machine belongs to.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name.
|
||||
func (client MachinesClient) ListMachineGroupMembership(resourceGroupName string, workspaceName string, machineName string) (result MachineGroupCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListMachineGroupMembership")
|
||||
}
|
||||
|
||||
req, err := client.ListMachineGroupMembershipPreparer(resourceGroupName, workspaceName, machineName)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMachineGroupMembershipSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListMachineGroupMembershipResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListMachineGroupMembershipPreparer prepares the ListMachineGroupMembership request.
|
||||
func (client MachinesClient) ListMachineGroupMembershipPreparer(resourceGroupName string, workspaceName string, machineName string) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
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}/features/serviceMap/machines/{machineName}/machineGroups", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListMachineGroupMembershipSender sends the ListMachineGroupMembership request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) ListMachineGroupMembershipSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListMachineGroupMembershipResponder handles the response to the ListMachineGroupMembership request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) ListMachineGroupMembershipResponder(resp *http.Response) (result MachineGroupCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListMachineGroupMembershipNextResults retrieves the next set of results, if any.
|
||||
func (client MachinesClient) ListMachineGroupMembershipNextResults(lastResults MachineGroupCollection) (result MachineGroupCollection, err error) {
|
||||
req, err := lastResults.MachineGroupCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListMachineGroupMembershipSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListMachineGroupMembershipResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPorts returns a collection of live ports on the specified machine during
|
||||
// the specified time interval.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. startTime is uTC date and
|
||||
// time specifying the start time of an interval. When not specified the
|
||||
// service uses DateTime.UtcNow - 10m endTime is uTC date and time specifying
|
||||
// the end time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow
|
||||
func (client MachinesClient) ListPorts(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result PortCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListPorts")
|
||||
}
|
||||
|
||||
req, err := client.ListPortsPreparer(resourceGroupName, workspaceName, machineName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListPortsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListPortsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListPortsPreparer prepares the ListPorts request.
|
||||
func (client MachinesClient) ListPortsPreparer(resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListPortsSender sends the ListPorts request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) ListPortsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListPortsResponder handles the response to the ListPorts request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) ListPortsResponder(resp *http.Response) (result PortCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListPortsNextResults retrieves the next set of results, if any.
|
||||
func (client MachinesClient) ListPortsNextResults(lastResults PortCollection) (result PortCollection, err error) {
|
||||
req, err := lastResults.PortCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListPortsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListPortsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListProcesses returns a collection of processes on the specified machine
|
||||
// matching the specified conditions. The returned collection represents either
|
||||
// processes that are active/live during the specified interval of time
|
||||
// (`live=true` and `startTime`/`endTime` are specified) or that are known to
|
||||
// have existed at or some time prior to the specified point in time
|
||||
// (`live=false` and `timestamp` is specified).
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. live is specifies whether to
|
||||
// return live resources (true) or inventory resources (false). Defaults to
|
||||
// **true**. When retrieving live resources, the start time (`startTime`) and
|
||||
// end time (`endTime`) of the desired interval should be included. When
|
||||
// retrieving inventory resources, an optional timestamp (`timestamp`)
|
||||
// parameter can be specified to return the version of each resource closest
|
||||
// (not-after) that timestamp. startTime is uTC date and time specifying the
|
||||
// start time of an interval. When not specified the service uses
|
||||
// DateTime.UtcNow - 10m endTime is uTC date and time specifying the end time
|
||||
// of an interval. When not specified the service uses DateTime.UtcNow
|
||||
// timestamp is uTC date and time specifying a time instance relative to which
|
||||
// to evaluate all process resource. Only applies when `live=false`. When not
|
||||
// specified, the service uses DateTime.UtcNow.
|
||||
func (client MachinesClient) ListProcesses(resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (result ProcessCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MachinesClient", "ListProcesses")
|
||||
}
|
||||
|
||||
req, err := client.ListProcessesPreparer(resourceGroupName, workspaceName, machineName, live, startTime, endTime, timestamp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListProcessesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListProcessesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListProcessesPreparer prepares the ListProcesses request.
|
||||
func (client MachinesClient) ListProcessesPreparer(resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if live != nil {
|
||||
queryParameters["live"] = autorest.Encode("query", *live)
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
if timestamp != nil {
|
||||
queryParameters["timestamp"] = autorest.Encode("query", *timestamp)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListProcessesSender sends the ListProcesses request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MachinesClient) ListProcessesSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListProcessesResponder handles the response to the ListProcesses request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MachinesClient) ListProcessesResponder(resp *http.Response) (result ProcessCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListProcessesNextResults retrieves the next set of results, if any.
|
||||
func (client MachinesClient) ListProcessesNextResults(lastResults ProcessCollection) (result ProcessCollection, err error) {
|
||||
req, err := lastResults.ProcessCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListProcessesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListProcessesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// MapsClient is the service Map API Reference
|
||||
type MapsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewMapsClient creates an instance of the MapsClient client.
|
||||
func NewMapsClient(subscriptionID string) MapsClient {
|
||||
return NewMapsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewMapsClientWithBaseURI creates an instance of the MapsClient client.
|
||||
func NewMapsClientWithBaseURI(baseURI string, subscriptionID string) MapsClient {
|
||||
return MapsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Generate generates the specified map.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. request is request options.
|
||||
func (client MapsClient) Generate(resourceGroupName string, workspaceName string, request MapRequest) (result MapResponse, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.MapsClient", "Generate")
|
||||
}
|
||||
|
||||
req, err := client.GeneratePreparer(resourceGroupName, workspaceName, request)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GenerateSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GenerateResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.MapsClient", "Generate", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GeneratePreparer prepares the Generate request.
|
||||
func (client MapsClient) GeneratePreparer(resourceGroupName string, workspaceName string, request MapRequest) (*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-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsJSON(),
|
||||
autorest.AsPost(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/generateMap", pathParameters),
|
||||
autorest.WithJSON(request),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GenerateSender sends the Generate request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client MapsClient) GenerateSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GenerateResponder handles the response to the Generate request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client MapsClient) GenerateResponder(resp *http.Response) (result MapResponse, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+759
@@ -0,0 +1,759 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/to"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// Accuracy enumerates the values for accuracy.
|
||||
type Accuracy string
|
||||
|
||||
const (
|
||||
// Actual specifies the actual state for accuracy.
|
||||
Actual Accuracy = "actual"
|
||||
// Estimated specifies the estimated state for accuracy.
|
||||
Estimated Accuracy = "estimated"
|
||||
)
|
||||
|
||||
// Bitness enumerates the values for bitness.
|
||||
type Bitness string
|
||||
|
||||
const (
|
||||
// SixFourbit specifies the six fourbit state for bitness.
|
||||
SixFourbit Bitness = "64bit"
|
||||
// ThreeTwobit specifies the three twobit state for bitness.
|
||||
ThreeTwobit Bitness = "32bit"
|
||||
)
|
||||
|
||||
// ConnectionFailureState enumerates the values for connection failure state.
|
||||
type ConnectionFailureState string
|
||||
|
||||
const (
|
||||
// Failed specifies the failed state for connection failure state.
|
||||
Failed ConnectionFailureState = "failed"
|
||||
// Mixed specifies the mixed state for connection failure state.
|
||||
Mixed ConnectionFailureState = "mixed"
|
||||
// Ok specifies the ok state for connection failure state.
|
||||
Ok ConnectionFailureState = "ok"
|
||||
)
|
||||
|
||||
// HypervisorType enumerates the values for hypervisor type.
|
||||
type HypervisorType string
|
||||
|
||||
const (
|
||||
// Hyperv specifies the hyperv state for hypervisor type.
|
||||
Hyperv HypervisorType = "hyperv"
|
||||
// Unknown specifies the unknown state for hypervisor type.
|
||||
Unknown HypervisorType = "unknown"
|
||||
)
|
||||
|
||||
// MachineRebootStatus enumerates the values for machine reboot status.
|
||||
type MachineRebootStatus string
|
||||
|
||||
const (
|
||||
// MachineRebootStatusNotRebooted specifies the machine reboot status not
|
||||
// rebooted state for machine reboot status.
|
||||
MachineRebootStatusNotRebooted MachineRebootStatus = "notRebooted"
|
||||
// MachineRebootStatusRebooted specifies the machine reboot status rebooted
|
||||
// state for machine reboot status.
|
||||
MachineRebootStatusRebooted MachineRebootStatus = "rebooted"
|
||||
// MachineRebootStatusUnknown specifies the machine reboot status unknown
|
||||
// state for machine reboot status.
|
||||
MachineRebootStatusUnknown MachineRebootStatus = "unknown"
|
||||
)
|
||||
|
||||
// MonitoringState enumerates the values for monitoring state.
|
||||
type MonitoringState string
|
||||
|
||||
const (
|
||||
// Discovered specifies the discovered state for monitoring state.
|
||||
Discovered MonitoringState = "discovered"
|
||||
// Monitored specifies the monitored state for monitoring state.
|
||||
Monitored MonitoringState = "monitored"
|
||||
)
|
||||
|
||||
// OperatingSystemFamily enumerates the values for operating system family.
|
||||
type OperatingSystemFamily string
|
||||
|
||||
const (
|
||||
// OperatingSystemFamilyAix specifies the operating system family aix state
|
||||
// for operating system family.
|
||||
OperatingSystemFamilyAix OperatingSystemFamily = "aix"
|
||||
// OperatingSystemFamilyLinux specifies the operating system family linux
|
||||
// state for operating system family.
|
||||
OperatingSystemFamilyLinux OperatingSystemFamily = "linux"
|
||||
// OperatingSystemFamilySolaris specifies the operating system family
|
||||
// solaris state for operating system family.
|
||||
OperatingSystemFamilySolaris OperatingSystemFamily = "solaris"
|
||||
// OperatingSystemFamilyUnknown specifies the operating system family
|
||||
// unknown state for operating system family.
|
||||
OperatingSystemFamilyUnknown OperatingSystemFamily = "unknown"
|
||||
// OperatingSystemFamilyWindows specifies the operating system family
|
||||
// windows state for operating system family.
|
||||
OperatingSystemFamilyWindows OperatingSystemFamily = "windows"
|
||||
)
|
||||
|
||||
// ProcessRole enumerates the values for process role.
|
||||
type ProcessRole string
|
||||
|
||||
const (
|
||||
// AppServer specifies the app server state for process role.
|
||||
AppServer ProcessRole = "appServer"
|
||||
// DatabaseServer specifies the database server state for process role.
|
||||
DatabaseServer ProcessRole = "databaseServer"
|
||||
// LdapServer specifies the ldap server state for process role.
|
||||
LdapServer ProcessRole = "ldapServer"
|
||||
// SmbServer specifies the smb server state for process role.
|
||||
SmbServer ProcessRole = "smbServer"
|
||||
// WebServer specifies the web server state for process role.
|
||||
WebServer ProcessRole = "webServer"
|
||||
)
|
||||
|
||||
// VirtualizationState enumerates the values for virtualization state.
|
||||
type VirtualizationState string
|
||||
|
||||
const (
|
||||
// VirtualizationStateHypervisor specifies the virtualization state
|
||||
// hypervisor state for virtualization state.
|
||||
VirtualizationStateHypervisor VirtualizationState = "hypervisor"
|
||||
// VirtualizationStatePhysical specifies the virtualization state physical
|
||||
// state for virtualization state.
|
||||
VirtualizationStatePhysical VirtualizationState = "physical"
|
||||
// VirtualizationStateUnknown specifies the virtualization state unknown
|
||||
// state for virtualization state.
|
||||
VirtualizationStateUnknown VirtualizationState = "unknown"
|
||||
// VirtualizationStateVirtual specifies the virtualization state virtual
|
||||
// state for virtualization state.
|
||||
VirtualizationStateVirtual VirtualizationState = "virtual"
|
||||
)
|
||||
|
||||
// VirtualMachineType enumerates the values for virtual machine type.
|
||||
type VirtualMachineType string
|
||||
|
||||
const (
|
||||
// VirtualMachineTypeHyperv specifies the virtual machine type hyperv state
|
||||
// for virtual machine type.
|
||||
VirtualMachineTypeHyperv VirtualMachineType = "hyperv"
|
||||
// VirtualMachineTypeLdom specifies the virtual machine type ldom state for
|
||||
// virtual machine type.
|
||||
VirtualMachineTypeLdom VirtualMachineType = "ldom"
|
||||
// VirtualMachineTypeLpar specifies the virtual machine type lpar state for
|
||||
// virtual machine type.
|
||||
VirtualMachineTypeLpar VirtualMachineType = "lpar"
|
||||
// VirtualMachineTypeUnknown specifies the virtual machine type unknown
|
||||
// state for virtual machine type.
|
||||
VirtualMachineTypeUnknown VirtualMachineType = "unknown"
|
||||
// VirtualMachineTypeVirtualPc specifies the virtual machine type virtual
|
||||
// pc state for virtual machine type.
|
||||
VirtualMachineTypeVirtualPc VirtualMachineType = "virtualPc"
|
||||
// VirtualMachineTypeVmware specifies the virtual machine type vmware state
|
||||
// for virtual machine type.
|
||||
VirtualMachineTypeVmware VirtualMachineType = "vmware"
|
||||
// VirtualMachineTypeXen specifies the virtual machine type xen state for
|
||||
// virtual machine type.
|
||||
VirtualMachineTypeXen VirtualMachineType = "xen"
|
||||
)
|
||||
|
||||
// Acceptor is a process accepting on a port.
|
||||
type Acceptor struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*AcceptorProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// AcceptorProperties is properties for an acceptor relationship.
|
||||
type AcceptorProperties struct {
|
||||
Source *PortReference `json:"source,omitempty"`
|
||||
Destination *ProcessReference `json:"destination,omitempty"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
}
|
||||
|
||||
// AgentConfiguration is describes the configuration of the Dependency Agent
|
||||
// installed on a machine.
|
||||
type AgentConfiguration struct {
|
||||
AgentID *string `json:"agentId,omitempty"`
|
||||
DependencyAgentID *string `json:"dependencyAgentId,omitempty"`
|
||||
DependencyAgentVersion *string `json:"dependencyAgentVersion,omitempty"`
|
||||
DependencyAgentRevision *string `json:"dependencyAgentRevision,omitempty"`
|
||||
RebootStatus MachineRebootStatus `json:"rebootStatus,omitempty"`
|
||||
ClockGranularity *int32 `json:"clockGranularity,omitempty"`
|
||||
}
|
||||
|
||||
// ClientGroup is represents a collection of clients of a resource. A client
|
||||
// group can represent the clients of a port, process, or a machine.
|
||||
type ClientGroup struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
*ClientGroupProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ClientGroupProperties is resource properties.
|
||||
type ClientGroupProperties struct {
|
||||
ClientsOf *ResourceReference `json:"clientsOf,omitempty"`
|
||||
}
|
||||
|
||||
// ClientGroupMember is represents a member of a client group
|
||||
type ClientGroupMember struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*ClientGroupMemberProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ClientGroupMemberProperties is resource properties.
|
||||
type ClientGroupMemberProperties struct {
|
||||
IPAddress *string `json:"ipAddress,omitempty"`
|
||||
Port *PortReference `json:"port,omitempty"`
|
||||
Processes *[]ProcessReference `json:"processes,omitempty"`
|
||||
}
|
||||
|
||||
// ClientGroupMembersCollection is collection of ClientGroupMember resources.
|
||||
type ClientGroupMembersCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]ClientGroupMember `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// ClientGroupMembersCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client ClientGroupMembersCollection) ClientGroupMembersCollectionPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// ClientGroupMembersCount is specifies the number of members in a client
|
||||
// group.
|
||||
type ClientGroupMembersCount struct {
|
||||
autorest.Response `json:"-"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
GroupID *string `json:"groupId,omitempty"`
|
||||
Count *int32 `json:"count,omitempty"`
|
||||
Accuracy Accuracy `json:"accuracy,omitempty"`
|
||||
}
|
||||
|
||||
// Connection is a network connection.
|
||||
type Connection struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*ConnectionProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ConnectionCollection is collection of Connection resources.
|
||||
type ConnectionCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Connection `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// ConnectionCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client ConnectionCollection) ConnectionCollectionPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// ConnectionProperties is properties for a connection resource.
|
||||
type ConnectionProperties struct {
|
||||
Source *ResourceReference `json:"source,omitempty"`
|
||||
Destination *ResourceReference `json:"destination,omitempty"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
ServerPort *PortReference `json:"serverPort,omitempty"`
|
||||
FailureState ConnectionFailureState `json:"failureState,omitempty"`
|
||||
}
|
||||
|
||||
// CoreResource is marker resource for the core Service Map resources
|
||||
type CoreResource struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
}
|
||||
|
||||
// Error is error details.
|
||||
type Error struct {
|
||||
Code *string `json:"code,omitempty"`
|
||||
Message *string `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// ErrorResponse is an error response from the API.
|
||||
type ErrorResponse struct {
|
||||
Error *Error `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// HypervisorConfiguration is describes the hypervisor configuration of a
|
||||
// machine.
|
||||
type HypervisorConfiguration struct {
|
||||
HypervisorType HypervisorType `json:"hypervisorType,omitempty"`
|
||||
NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
|
||||
}
|
||||
|
||||
// Ipv4NetworkInterface is describes an IPv4 network interface.
|
||||
type Ipv4NetworkInterface struct {
|
||||
IPAddress *string `json:"ipAddress,omitempty"`
|
||||
SubnetMask *string `json:"subnetMask,omitempty"`
|
||||
}
|
||||
|
||||
// Ipv6NetworkInterface is describes an IPv6 network interface.
|
||||
type Ipv6NetworkInterface struct {
|
||||
IPAddress *string `json:"ipAddress,omitempty"`
|
||||
}
|
||||
|
||||
// Liveness is specifies the contents of a check liveness response.
|
||||
type Liveness struct {
|
||||
autorest.Response `json:"-"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
Live *bool `json:"live,omitempty"`
|
||||
}
|
||||
|
||||
// Machine is a machine resource represents a discovered computer system. It
|
||||
// can be *monitored*, i.e., a Dependency Agent is running on it, or
|
||||
// *discovered*, i.e., its existence was inferred by observing the data stream
|
||||
// from monitored machines. As machines change, prior versions of the machine
|
||||
// resource are preserved and available for access. A machine is live during an
|
||||
// interval of time, if either its Dependency Agent has reported data during
|
||||
// (parts) of that interval, or a Dependency agent running on other machines
|
||||
// has reported activity associated with the machine.
|
||||
type Machine struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
*MachineProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// MachineProperties is resource properties.
|
||||
type MachineProperties struct {
|
||||
Timestamp *date.Time `json:"timestamp,omitempty"`
|
||||
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
|
||||
VirtualizationState VirtualizationState `json:"virtualizationState,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
ComputerName *string `json:"computerName,omitempty"`
|
||||
FullyQualifiedDomainName *string `json:"fullyQualifiedDomainName,omitempty"`
|
||||
BootTime *date.Time `json:"bootTime,omitempty"`
|
||||
Timezone *Timezone `json:"timezone,omitempty"`
|
||||
Agent *AgentConfiguration `json:"agent,omitempty"`
|
||||
Resources *MachineResourcesConfiguration `json:"resources,omitempty"`
|
||||
Networking *NetworkConfiguration `json:"networking,omitempty"`
|
||||
OperatingSystem *OperatingSystemConfiguration `json:"operatingSystem,omitempty"`
|
||||
VirtualMachine *VirtualMachineConfiguration `json:"virtualMachine,omitempty"`
|
||||
Hypervisor *HypervisorConfiguration `json:"hypervisor,omitempty"`
|
||||
}
|
||||
|
||||
// MachineCollection is collection of Machine resources.
|
||||
type MachineCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Machine `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// MachineCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client MachineCollection) MachineCollectionPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// MachineCountsByOperatingSystem is machines by operating system.
|
||||
type MachineCountsByOperatingSystem struct {
|
||||
Windows *int32 `json:"windows,omitempty"`
|
||||
Linux *int32 `json:"linux,omitempty"`
|
||||
}
|
||||
|
||||
// MachineGroup is a user-defined logical grouping of machines.
|
||||
type MachineGroup struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
*MachineGroupProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// MachineGroupProperties is resource properties.
|
||||
type MachineGroupProperties struct {
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
Machines *[]MachineReferenceWithHints `json:"machines,omitempty"`
|
||||
}
|
||||
|
||||
// MachineGroupCollection is collection of Machine Group resources.
|
||||
type MachineGroupCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]MachineGroup `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// MachineGroupCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client MachineGroupCollection) MachineGroupCollectionPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// MachineGroupMapRequest is specifies the computation of a machine group
|
||||
// dependency map. A machine group dependency map includes all direct
|
||||
// dependencies of a group of machines.
|
||||
type MachineGroupMapRequest struct {
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
MachineGroupID *string `json:"machineGroupId,omitempty"`
|
||||
FilterProcesses *bool `json:"filterProcesses,omitempty"`
|
||||
}
|
||||
|
||||
// MachineReference is reference to a machine.
|
||||
type MachineReference struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// MachineReferenceWithHints is a machine reference with a hint of the
|
||||
// machine's name and operating system.
|
||||
type MachineReferenceWithHints struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*MachineReferenceWithHintsProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// MachineReferenceWithHintsProperties is machine reference with name and os
|
||||
// hints.
|
||||
type MachineReferenceWithHintsProperties struct {
|
||||
DisplayNameHint *string `json:"displayNameHint,omitempty"`
|
||||
OsFamilyHint OperatingSystemFamily `json:"osFamilyHint,omitempty"`
|
||||
}
|
||||
|
||||
// MachineResourcesConfiguration is describes the resources of a machine.
|
||||
type MachineResourcesConfiguration struct {
|
||||
PhysicalMemory *int32 `json:"physicalMemory,omitempty"`
|
||||
Cpus *int32 `json:"cpus,omitempty"`
|
||||
CPUSpeed *int32 `json:"cpuSpeed,omitempty"`
|
||||
CPUSpeedAccuracy Accuracy `json:"cpuSpeedAccuracy,omitempty"`
|
||||
}
|
||||
|
||||
// MachinesSummary is a summary of the machines in the workspace.
|
||||
type MachinesSummary struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*MachinesSummaryProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// MachinesSummaryProperties is summarizes machines in the workspace.
|
||||
type MachinesSummaryProperties struct {
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
Total *int32 `json:"total,omitempty"`
|
||||
Live *int32 `json:"live,omitempty"`
|
||||
Os *MachineCountsByOperatingSystem `json:"os,omitempty"`
|
||||
}
|
||||
|
||||
// Map is a map of resources and relationships between them.
|
||||
type Map struct {
|
||||
Nodes *MapNodes `json:"nodes,omitempty"`
|
||||
Edges *MapEdges `json:"edges,omitempty"`
|
||||
}
|
||||
|
||||
// MapEdges is the edges (relationships) of a map.
|
||||
type MapEdges struct {
|
||||
Connections *[]Connection `json:"connections,omitempty"`
|
||||
Acceptors *[]Acceptor `json:"acceptors,omitempty"`
|
||||
}
|
||||
|
||||
// MapNodes is the nodes (entities) of a map.
|
||||
type MapNodes struct {
|
||||
Machines *[]Machine `json:"machines,omitempty"`
|
||||
Processes *[]Process `json:"processes,omitempty"`
|
||||
Ports *[]Port `json:"Ports,omitempty"`
|
||||
ClientGroups *[]ClientGroup `json:"ClientGroups,omitempty"`
|
||||
}
|
||||
|
||||
// MapRequest is specifies the contents of request to generate a map.
|
||||
type MapRequest struct {
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
}
|
||||
|
||||
// MapResponse is specified the contents of a map response.
|
||||
type MapResponse struct {
|
||||
autorest.Response `json:"-"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
Map *Map `json:"map,omitempty"`
|
||||
}
|
||||
|
||||
// NetworkConfiguration is describes the network configuration of a machine.
|
||||
type NetworkConfiguration struct {
|
||||
Ipv4Interfaces *[]Ipv4NetworkInterface `json:"ipv4Interfaces,omitempty"`
|
||||
Ipv6Interfaces *[]Ipv6NetworkInterface `json:"ipv6Interfaces,omitempty"`
|
||||
DefaultIpv4Gateways *[]string `json:"defaultIpv4Gateways,omitempty"`
|
||||
MacAddresses *[]string `json:"macAddresses,omitempty"`
|
||||
DNSNames *[]string `json:"dnsNames,omitempty"`
|
||||
}
|
||||
|
||||
// OperatingSystemConfiguration is describes the configuration of the operating
|
||||
// system of a machine.
|
||||
type OperatingSystemConfiguration struct {
|
||||
Family OperatingSystemFamily `json:"family,omitempty"`
|
||||
FullName *string `json:"fullName,omitempty"`
|
||||
Bitness Bitness `json:"bitness,omitempty"`
|
||||
}
|
||||
|
||||
// Port is a port resource represents a server port on a machine. The port may
|
||||
// be actively *monitored*, i.e., a Dependency Agent is running on its machine,
|
||||
// or *discovered*, i.e., its existence was inferred by observing the data
|
||||
// stream from monitored machines. A port is live during an interval of time,
|
||||
// if that port had associated activity during (parts) of that interval.
|
||||
type Port struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
*PortProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// PortProperties is resource properties.
|
||||
type PortProperties struct {
|
||||
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
|
||||
Machine *ResourceReference `json:"machine,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
IPAddress *string `json:"ipAddress,omitempty"`
|
||||
PortNumber *int32 `json:"portNumber,omitempty"`
|
||||
}
|
||||
|
||||
// PortCollection is collection of Port resources.
|
||||
type PortCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Port `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// PortCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client PortCollection) PortCollectionPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// PortReference is reference to a port.
|
||||
type PortReference struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*PortReferenceProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// PortReferenceProperties is resource properties.
|
||||
type PortReferenceProperties struct {
|
||||
Machine *MachineReference `json:"machine,omitempty"`
|
||||
IPAddress *string `json:"ipAddress,omitempty"`
|
||||
PortNumber *int32 `json:"portNumber,omitempty"`
|
||||
}
|
||||
|
||||
// Process is a process resource represents a process running on a machine. The
|
||||
// process may be actively *monitored*, i.e., a Dependency Agent is running on
|
||||
// its machine, or *discovered*, i.e., its existence was inferred by observing
|
||||
// the data stream from monitored machines. A process resource represents a
|
||||
// pool of actual operating system resources that share command lines and
|
||||
// metadata. As the process pool evolves over time, prior versions of the
|
||||
// process resource are preserved and available for access. A process is live
|
||||
// during an interval of time, if that process is executing during (parts) of
|
||||
// that interval
|
||||
type Process struct {
|
||||
autorest.Response `json:"-"`
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
Etag *string `json:"etag,omitempty"`
|
||||
*ProcessProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ProcessProperties is resource properties.
|
||||
type ProcessProperties struct {
|
||||
Timestamp *date.Time `json:"timestamp,omitempty"`
|
||||
MonitoringState MonitoringState `json:"monitoringState,omitempty"`
|
||||
Machine *ResourceReference `json:"machine,omitempty"`
|
||||
ExecutableName *string `json:"executableName,omitempty"`
|
||||
DisplayName *string `json:"displayName,omitempty"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
Role ProcessRole `json:"role,omitempty"`
|
||||
Details *ProcessDetails `json:"details,omitempty"`
|
||||
User *ProcessUser `json:"user,omitempty"`
|
||||
ClientOf *ResourceReference `json:"clientOf,omitempty"`
|
||||
AcceptorOf *ResourceReference `json:"acceptorOf,omitempty"`
|
||||
}
|
||||
|
||||
// ProcessCollection is collection of Process resources.
|
||||
type ProcessCollection struct {
|
||||
autorest.Response `json:"-"`
|
||||
Value *[]Process `json:"value,omitempty"`
|
||||
NextLink *string `json:"nextLink,omitempty"`
|
||||
}
|
||||
|
||||
// ProcessCollectionPreparer prepares a request to retrieve the next set of results. It returns
|
||||
// nil if no more results exist.
|
||||
func (client ProcessCollection) ProcessCollectionPreparer() (*http.Request, error) {
|
||||
if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return autorest.Prepare(&http.Request{},
|
||||
autorest.AsJSON(),
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(to.String(client.NextLink)))
|
||||
}
|
||||
|
||||
// ProcessDetails is describes process metadata.
|
||||
type ProcessDetails struct {
|
||||
PersistentKey *string `json:"persistentKey,omitempty"`
|
||||
PoolID *int32 `json:"poolId,omitempty"`
|
||||
FirstPid *int32 `json:"firstPid,omitempty"`
|
||||
Description *string `json:"description,omitempty"`
|
||||
CompanyName *string `json:"companyName,omitempty"`
|
||||
InternalName *string `json:"internalName,omitempty"`
|
||||
ProductName *string `json:"productName,omitempty"`
|
||||
ProductVersion *string `json:"productVersion,omitempty"`
|
||||
FileVersion *string `json:"fileVersion,omitempty"`
|
||||
CommandLine *string `json:"commandLine,omitempty"`
|
||||
ExecutablePath *string `json:"executablePath,omitempty"`
|
||||
WorkingDirectory *string `json:"workingDirectory,omitempty"`
|
||||
}
|
||||
|
||||
// ProcessReference is reference to a process.
|
||||
type ProcessReference struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
*ProcessReferenceProperties `json:"properties,omitempty"`
|
||||
}
|
||||
|
||||
// ProcessReferenceProperties is resource properties.
|
||||
type ProcessReferenceProperties struct {
|
||||
Machine *MachineReference `json:"machine,omitempty"`
|
||||
}
|
||||
|
||||
// ProcessUser is describes the user under which a process is running.
|
||||
type ProcessUser struct {
|
||||
UserName *string `json:"userName,omitempty"`
|
||||
UserDomain *string `json:"userDomain,omitempty"`
|
||||
}
|
||||
|
||||
// Relationship is a typed relationship between two entities.
|
||||
type Relationship struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// RelationshipProperties is relationship properties.
|
||||
type RelationshipProperties struct {
|
||||
Source *ResourceReference `json:"source,omitempty"`
|
||||
Destination *ResourceReference `json:"destination,omitempty"`
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
}
|
||||
|
||||
// Resource is resource model definition.
|
||||
type Resource struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// ResourceReference is represents a reference to another resource.
|
||||
type ResourceReference struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// SingleMachineDependencyMapRequest is specifies the computation of a single
|
||||
// server dependency map. A single server dependency map includes all direct
|
||||
// dependencies of a given machine.
|
||||
type SingleMachineDependencyMapRequest struct {
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
MachineID *string `json:"machineId,omitempty"`
|
||||
}
|
||||
|
||||
// Summary is base for all resource summaries.
|
||||
type Summary struct {
|
||||
ID *string `json:"id,omitempty"`
|
||||
Type *string `json:"type,omitempty"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// SummaryProperties is base for all summaries.
|
||||
type SummaryProperties struct {
|
||||
StartTime *date.Time `json:"startTime,omitempty"`
|
||||
EndTime *date.Time `json:"endTime,omitempty"`
|
||||
}
|
||||
|
||||
// Timezone is describes a timezone.
|
||||
type Timezone struct {
|
||||
FullName *string `json:"fullName,omitempty"`
|
||||
}
|
||||
|
||||
// VirtualMachineConfiguration is describes the virtualizaton-related
|
||||
// configuration of a machine.
|
||||
type VirtualMachineConfiguration struct {
|
||||
VirtualMachineType VirtualMachineType `json:"virtualMachineType,omitempty"`
|
||||
NativeMachineID *string `json:"nativeMachineId,omitempty"`
|
||||
VirtualMachineName *string `json:"virtualMachineName,omitempty"`
|
||||
NativeHostMachineID *string `json:"nativeHostMachineId,omitempty"`
|
||||
}
|
||||
+483
@@ -0,0 +1,483 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// PortsClient is the service Map API Reference
|
||||
type PortsClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewPortsClient creates an instance of the PortsClient client.
|
||||
func NewPortsClient(subscriptionID string) PortsClient {
|
||||
return NewPortsClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewPortsClientWithBaseURI creates an instance of the PortsClient client.
|
||||
func NewPortsClientWithBaseURI(baseURI string, subscriptionID string) PortsClient {
|
||||
return PortsClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get returns the specified port. The port must be live during the specified
|
||||
// time interval. If the port is not live during the interval, status 404 (Not
|
||||
// Found) is returned.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. portName is port resource
|
||||
// name. startTime is uTC date and time specifying the start time of an
|
||||
// interval. When not specified the service uses DateTime.UtcNow - 10m endTime
|
||||
// is uTC date and time specifying the end time of an interval. When not
|
||||
// specified the service uses DateTime.UtcNow
|
||||
func (client PortsClient) Get(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result Port, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: portName,
|
||||
Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client PortsClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"portName": autorest.Encode("path", portName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PortsClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PortsClient) GetResponder(resp *http.Response) (result Port, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetLiveness obtains the liveness status of the port during the specified
|
||||
// time interval.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. portName is port resource
|
||||
// name. startTime is uTC date and time specifying the start time of an
|
||||
// interval. When not specified the service uses DateTime.UtcNow - 10m endTime
|
||||
// is uTC date and time specifying the end time of an interval. When not
|
||||
// specified the service uses DateTime.UtcNow
|
||||
func (client PortsClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: portName,
|
||||
Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "GetLiveness")
|
||||
}
|
||||
|
||||
req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetLivenessSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetLivenessResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "GetLiveness", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetLivenessPreparer prepares the GetLiveness request.
|
||||
func (client PortsClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"portName": autorest.Encode("path", portName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/liveness", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetLivenessSender sends the GetLiveness request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PortsClient) GetLivenessSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetLivenessResponder handles the response to the GetLiveness request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PortsClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListAcceptingProcesses returns a collection of processes accepting on the
|
||||
// specified port
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. portName is port resource
|
||||
// name. startTime is uTC date and time specifying the start time of an
|
||||
// interval. When not specified the service uses DateTime.UtcNow - 10m endTime
|
||||
// is uTC date and time specifying the end time of an interval. When not
|
||||
// specified the service uses DateTime.UtcNow
|
||||
func (client PortsClient) ListAcceptingProcesses(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result ProcessCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: portName,
|
||||
Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "ListAcceptingProcesses")
|
||||
}
|
||||
|
||||
req, err := client.ListAcceptingProcessesPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListAcceptingProcessesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListAcceptingProcessesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListAcceptingProcessesPreparer prepares the ListAcceptingProcesses request.
|
||||
func (client PortsClient) ListAcceptingProcessesPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"portName": autorest.Encode("path", portName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/acceptingProcesses", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAcceptingProcessesSender sends the ListAcceptingProcesses request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PortsClient) ListAcceptingProcessesSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListAcceptingProcessesResponder handles the response to the ListAcceptingProcesses request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PortsClient) ListAcceptingProcessesResponder(resp *http.Response) (result ProcessCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListAcceptingProcessesNextResults retrieves the next set of results, if any.
|
||||
func (client PortsClient) ListAcceptingProcessesNextResults(lastResults ProcessCollection) (result ProcessCollection, err error) {
|
||||
req, err := lastResults.ProcessCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListAcceptingProcessesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListAcceptingProcessesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListAcceptingProcesses", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnections returns a collection of connections established via the
|
||||
// specified port.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. portName is port resource
|
||||
// name. startTime is uTC date and time specifying the start time of an
|
||||
// interval. When not specified the service uses DateTime.UtcNow - 10m endTime
|
||||
// is uTC date and time specifying the end time of an interval. When not
|
||||
// specified the service uses DateTime.UtcNow
|
||||
func (client PortsClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: portName,
|
||||
Constraints: []validation.Constraint{{Target: "portName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "portName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.PortsClient", "ListConnections")
|
||||
}
|
||||
|
||||
req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, portName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListConnectionsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListConnectionsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnectionsPreparer prepares the ListConnections request.
|
||||
func (client PortsClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, portName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"portName": autorest.Encode("path", portName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/ports/{portName}/connections", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListConnectionsSender sends the ListConnections request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client PortsClient) ListConnectionsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListConnectionsResponder handles the response to the ListConnections request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client PortsClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnectionsNextResults retrieves the next set of results, if any.
|
||||
func (client PortsClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) {
|
||||
req, err := lastResults.ConnectionCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListConnectionsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListConnectionsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.PortsClient", "ListConnections", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+478
@@ -0,0 +1,478 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// ProcessesClient is the service Map API Reference
|
||||
type ProcessesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewProcessesClient creates an instance of the ProcessesClient client.
|
||||
func NewProcessesClient(subscriptionID string) ProcessesClient {
|
||||
return NewProcessesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewProcessesClientWithBaseURI creates an instance of the ProcessesClient
|
||||
// client.
|
||||
func NewProcessesClientWithBaseURI(baseURI string, subscriptionID string) ProcessesClient {
|
||||
return ProcessesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// Get returns the specified process.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. processName is process
|
||||
// resource name. timestamp is uTC date and time specifying a time instance
|
||||
// relative to which to evaluate a resource. When not specified, the service
|
||||
// uses DateTime.UtcNow.
|
||||
func (client ProcessesClient) Get(resourceGroupName string, workspaceName string, machineName string, processName string, timestamp *date.Time) (result Process, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: processName,
|
||||
Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil},
|
||||
{Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "Get")
|
||||
}
|
||||
|
||||
req, err := client.GetPreparer(resourceGroupName, workspaceName, machineName, processName, timestamp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "Get", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetPreparer prepares the Get request.
|
||||
func (client ProcessesClient) GetPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, timestamp *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"processName": autorest.Encode("path", processName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if timestamp != nil {
|
||||
queryParameters["timestamp"] = autorest.Encode("query", *timestamp)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetSender sends the Get request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ProcessesClient) GetSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetResponder handles the response to the Get request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ProcessesClient) GetResponder(resp *http.Response) (result Process, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// GetLiveness obtains the liveness status of the process during the specified
|
||||
// time interval.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. processName is process
|
||||
// resource name. startTime is uTC date and time specifying the start time of
|
||||
// an interval. When not specified the service uses DateTime.UtcNow - 10m
|
||||
// endTime is uTC date and time specifying the end time of an interval. When
|
||||
// not specified the service uses DateTime.UtcNow
|
||||
func (client ProcessesClient) GetLiveness(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: processName,
|
||||
Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil},
|
||||
{Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "GetLiveness")
|
||||
}
|
||||
|
||||
req, err := client.GetLivenessPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetLivenessSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetLivenessResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "GetLiveness", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetLivenessPreparer prepares the GetLiveness request.
|
||||
func (client ProcessesClient) GetLivenessPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"processName": autorest.Encode("path", processName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/liveness", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetLivenessSender sends the GetLiveness request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ProcessesClient) GetLivenessSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetLivenessResponder handles the response to the GetLiveness request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ProcessesClient) GetLivenessResponder(resp *http.Response) (result Liveness, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListAcceptingPorts returns a collection of ports on which this process is
|
||||
// accepting
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. processName is process
|
||||
// resource name. startTime is uTC date and time specifying the start time of
|
||||
// an interval. When not specified the service uses DateTime.UtcNow - 10m
|
||||
// endTime is uTC date and time specifying the end time of an interval. When
|
||||
// not specified the service uses DateTime.UtcNow
|
||||
func (client ProcessesClient) ListAcceptingPorts(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result PortCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: processName,
|
||||
Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil},
|
||||
{Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "ListAcceptingPorts")
|
||||
}
|
||||
|
||||
req, err := client.ListAcceptingPortsPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListAcceptingPortsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListAcceptingPortsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListAcceptingPortsPreparer prepares the ListAcceptingPorts request.
|
||||
func (client ProcessesClient) ListAcceptingPortsPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"processName": autorest.Encode("path", processName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/acceptingPorts", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListAcceptingPortsSender sends the ListAcceptingPorts request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ProcessesClient) ListAcceptingPortsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListAcceptingPortsResponder handles the response to the ListAcceptingPorts request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ProcessesClient) ListAcceptingPortsResponder(resp *http.Response) (result PortCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListAcceptingPortsNextResults retrieves the next set of results, if any.
|
||||
func (client ProcessesClient) ListAcceptingPortsNextResults(lastResults PortCollection) (result PortCollection, err error) {
|
||||
req, err := lastResults.PortCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListAcceptingPortsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListAcceptingPortsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListAcceptingPorts", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnections returns a collection of connections terminating or
|
||||
// originating at the specified process
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. machineName is machine resource name. processName is process
|
||||
// resource name. startTime is uTC date and time specifying the start time of
|
||||
// an interval. When not specified the service uses DateTime.UtcNow - 10m
|
||||
// endTime is uTC date and time specifying the end time of an interval. When
|
||||
// not specified the service uses DateTime.UtcNow
|
||||
func (client ProcessesClient) ListConnections(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollection, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}},
|
||||
{TargetValue: machineName,
|
||||
Constraints: []validation.Constraint{{Target: "machineName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "machineName", Name: validation.MinLength, Rule: 3, Chain: nil}}},
|
||||
{TargetValue: processName,
|
||||
Constraints: []validation.Constraint{{Target: "processName", Name: validation.MaxLength, Rule: 128, Chain: nil},
|
||||
{Target: "processName", Name: validation.MinLength, Rule: 3, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.ProcessesClient", "ListConnections")
|
||||
}
|
||||
|
||||
req, err := client.ListConnectionsPreparer(resourceGroupName, workspaceName, machineName, processName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListConnectionsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.ListConnectionsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnectionsPreparer prepares the ListConnections request.
|
||||
func (client ProcessesClient) ListConnectionsPreparer(resourceGroupName string, workspaceName string, machineName string, processName string, startTime *date.Time, endTime *date.Time) (*http.Request, error) {
|
||||
pathParameters := map[string]interface{}{
|
||||
"machineName": autorest.Encode("path", machineName),
|
||||
"processName": autorest.Encode("path", processName),
|
||||
"resourceGroupName": autorest.Encode("path", resourceGroupName),
|
||||
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
|
||||
"workspaceName": autorest.Encode("path", workspaceName),
|
||||
}
|
||||
|
||||
const APIVersion = "2015-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/machines/{machineName}/processes/{processName}/connections", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// ListConnectionsSender sends the ListConnections request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client ProcessesClient) ListConnectionsSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// ListConnectionsResponder handles the response to the ListConnections request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client ProcessesClient) ListConnectionsResponder(resp *http.Response) (result ConnectionCollection, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
|
||||
// ListConnectionsNextResults retrieves the next set of results, if any.
|
||||
func (client ProcessesClient) ListConnectionsNextResults(lastResults ConnectionCollection) (result ConnectionCollection, err error) {
|
||||
req, err := lastResults.ConnectionCollectionPreparer()
|
||||
if err != nil {
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", nil, "Failure preparing next results request")
|
||||
}
|
||||
if req == nil {
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.ListConnectionsSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return result, autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure sending next results request")
|
||||
}
|
||||
|
||||
result, err = client.ListConnectionsResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.ProcessesClient", "ListConnections", resp, "Failure responding to next results request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
+131
@@ -0,0 +1,131 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
import (
|
||||
"github.com/Azure/go-autorest/autorest"
|
||||
"github.com/Azure/go-autorest/autorest/azure"
|
||||
"github.com/Azure/go-autorest/autorest/date"
|
||||
"github.com/Azure/go-autorest/autorest/validation"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// SummariesClient is the service Map API Reference
|
||||
type SummariesClient struct {
|
||||
ManagementClient
|
||||
}
|
||||
|
||||
// NewSummariesClient creates an instance of the SummariesClient client.
|
||||
func NewSummariesClient(subscriptionID string) SummariesClient {
|
||||
return NewSummariesClientWithBaseURI(DefaultBaseURI, subscriptionID)
|
||||
}
|
||||
|
||||
// NewSummariesClientWithBaseURI creates an instance of the SummariesClient
|
||||
// client.
|
||||
func NewSummariesClientWithBaseURI(baseURI string, subscriptionID string) SummariesClient {
|
||||
return SummariesClient{NewWithBaseURI(baseURI, subscriptionID)}
|
||||
}
|
||||
|
||||
// GetMachines returns summary information about the machines in the workspace.
|
||||
//
|
||||
// resourceGroupName is resource group name within the specified
|
||||
// subscriptionId. workspaceName is oMS workspace containing the resources of
|
||||
// interest. startTime is uTC date and time specifying the start time of an
|
||||
// interval. When not specified the service uses DateTime.UtcNow - 10m endTime
|
||||
// is uTC date and time specifying the end time of an interval. When not
|
||||
// specified the service uses DateTime.UtcNow
|
||||
func (client SummariesClient) GetMachines(resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (result MachinesSummary, err error) {
|
||||
if err := validation.Validate([]validation.Validation{
|
||||
{TargetValue: resourceGroupName,
|
||||
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil},
|
||||
{Target: "resourceGroupName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_-]+`, Chain: nil}}},
|
||||
{TargetValue: workspaceName,
|
||||
Constraints: []validation.Constraint{{Target: "workspaceName", Name: validation.MaxLength, Rule: 63, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.MinLength, Rule: 3, Chain: nil},
|
||||
{Target: "workspaceName", Name: validation.Pattern, Rule: `[a-zA-Z0-9_][a-zA-Z0-9_-]+[a-zA-Z0-9_]`, Chain: nil}}}}); err != nil {
|
||||
return result, validation.NewErrorWithValidationError(err, "servicemap.SummariesClient", "GetMachines")
|
||||
}
|
||||
|
||||
req, err := client.GetMachinesPreparer(resourceGroupName, workspaceName, startTime, endTime)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", nil, "Failure preparing request")
|
||||
return
|
||||
}
|
||||
|
||||
resp, err := client.GetMachinesSender(req)
|
||||
if err != nil {
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", resp, "Failure sending request")
|
||||
return
|
||||
}
|
||||
|
||||
result, err = client.GetMachinesResponder(resp)
|
||||
if err != nil {
|
||||
err = autorest.NewErrorWithError(err, "servicemap.SummariesClient", "GetMachines", resp, "Failure responding to request")
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
// GetMachinesPreparer prepares the GetMachines request.
|
||||
func (client SummariesClient) GetMachinesPreparer(resourceGroupName string, workspaceName string, startTime *date.Time, endTime *date.Time) (*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-11-01-preview"
|
||||
queryParameters := map[string]interface{}{
|
||||
"api-version": APIVersion,
|
||||
}
|
||||
if startTime != nil {
|
||||
queryParameters["startTime"] = autorest.Encode("query", *startTime)
|
||||
}
|
||||
if endTime != nil {
|
||||
queryParameters["endTime"] = autorest.Encode("query", *endTime)
|
||||
}
|
||||
|
||||
preparer := autorest.CreatePreparer(
|
||||
autorest.AsGet(),
|
||||
autorest.WithBaseURL(client.BaseURI),
|
||||
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/features/serviceMap/summaries/machines", pathParameters),
|
||||
autorest.WithQueryParameters(queryParameters))
|
||||
return preparer.Prepare(&http.Request{})
|
||||
}
|
||||
|
||||
// GetMachinesSender sends the GetMachines request. The method will close the
|
||||
// http.Response Body if it receives an error.
|
||||
func (client SummariesClient) GetMachinesSender(req *http.Request) (*http.Response, error) {
|
||||
return autorest.SendWithSender(client, req)
|
||||
}
|
||||
|
||||
// GetMachinesResponder handles the response to the GetMachines request. The method always
|
||||
// closes the http.Response Body.
|
||||
func (client SummariesClient) GetMachinesResponder(resp *http.Response) (result MachinesSummary, err error) {
|
||||
err = autorest.Respond(
|
||||
resp,
|
||||
client.ByInspecting(),
|
||||
azure.WithErrorUnlessStatusCode(http.StatusOK),
|
||||
autorest.ByUnmarshallingJSON(&result),
|
||||
autorest.ByClosing())
|
||||
result.Response = autorest.Response{Response: resp}
|
||||
return
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package servicemap
|
||||
|
||||
// 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 1.0.1.0
|
||||
// Changes may cause incorrect behavior and will be lost if the code is
|
||||
// regenerated.
|
||||
|
||||
// UserAgent returns the UserAgent string to use when sending http.Requests.
|
||||
func UserAgent() string {
|
||||
return "Azure-SDK-For-Go/v10.1.0-beta arm-servicemap/2015-11-01-preview"
|
||||
}
|
||||
|
||||
// Version returns the semantic version (see http://semver.org) of the client.
|
||||
func Version() string {
|
||||
return "v10.1.0-beta"
|
||||
}
|
||||
Reference in New Issue
Block a user