1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
|
package servicemap
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
"context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/date"
"github.com/Azure/go-autorest/autorest/validation"
"github.com/Azure/go-autorest/tracing"
"net/http"
)
// MachinesClient is the service Map API Reference
type MachinesClient struct {
BaseClient
}
// 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 using a custom endpoint. Use this
// when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).
func NewMachinesClientWithBaseURI(baseURI string, subscriptionID string) MachinesClient {
return MachinesClient{NewWithBaseURI(baseURI, subscriptionID)}
}
// Get returns the specified machine.
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// machineName - machine resource name.
// timestamp - 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(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, timestamp *date.Time) (result Machine, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.Get")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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.NewError("servicemap.MachinesClient", "Get", err.Error())
}
req, err := client.GetPreparer(ctx, 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
}
return
}
// GetPreparer prepares the Get request.
func (client MachinesClient) GetPreparer(ctx context.Context, 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{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
// closes the http.Response Body.
func (client MachinesClient) GetResponder(resp *http.Response) (result Machine, err error) {
err = autorest.Respond(
resp,
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.
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// machineName - machine resource name.
// startTime - UTC date and time specifying the start time of an interval. When not specified the service uses
// DateTime.UtcNow - 10m
// endTime - UTC date and time specifying the end time of an interval. When not specified the service uses
// DateTime.UtcNow
func (client MachinesClient) GetLiveness(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result Liveness, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.GetLiveness")
defer func() {
sc := -1
if result.Response.Response != nil {
sc = result.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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.NewError("servicemap.MachinesClient", "GetLiveness", err.Error())
}
req, err := client.GetLivenessPreparer(ctx, 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
}
return
}
// GetLivenessPreparer prepares the GetLiveness request.
func (client MachinesClient) GetLivenessPreparer(ctx context.Context, 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{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// 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,
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).
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// live - 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 - UTC date and time specifying the start time of an interval. When not specified the service uses
// DateTime.UtcNow - 10m
// endTime - UTC date and time specifying the end time of an interval. When not specified the service uses
// DateTime.UtcNow
// timestamp - 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 - page size to use. When not specified, the default page size is 100 records.
func (client MachinesClient) ListByWorkspace(ctx context.Context, resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (result MachineCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListByWorkspace")
defer func() {
sc := -1
if result.mc.Response.Response != nil {
sc = result.mc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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: int64(200), Chain: nil},
{Target: "top", Name: validation.InclusiveMinimum, Rule: int64(1), Chain: nil},
}}}}}); err != nil {
return result, validation.NewError("servicemap.MachinesClient", "ListByWorkspace", err.Error())
}
result.fn = client.listByWorkspaceNextResults
req, err := client.ListByWorkspacePreparer(ctx, 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.mc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure sending request")
return
}
result.mc, err = client.ListByWorkspaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListByWorkspace", resp, "Failure responding to request")
return
}
if result.mc.hasNextLink() && result.mc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListByWorkspacePreparer prepares the ListByWorkspace request.
func (client MachinesClient) ListByWorkspacePreparer(ctx context.Context, 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)
} else {
queryParameters["live"] = autorest.Encode("query", true)
}
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{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// 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,
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(ctx context.Context, lastResults MachineCollection) (result MachineCollection, err error) {
req, err := lastResults.machineCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listByWorkspaceNextResults", 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", "listByWorkspaceNextResults", resp, "Failure sending next results request")
}
result, err = client.ListByWorkspaceResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listByWorkspaceNextResults", resp, "Failure responding to next results request")
}
return
}
// ListByWorkspaceComplete enumerates all values, automatically crossing page boundaries as required.
func (client MachinesClient) ListByWorkspaceComplete(ctx context.Context, resourceGroupName string, workspaceName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time, top *int32) (result MachineCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListByWorkspace")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListByWorkspace(ctx, resourceGroupName, workspaceName, live, startTime, endTime, timestamp, top)
return
}
// ListConnections returns a collection of connections terminating or originating at the specified machine
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// machineName - machine resource name.
// startTime - UTC date and time specifying the start time of an interval. When not specified the service uses
// DateTime.UtcNow - 10m
// endTime - UTC date and time specifying the end time of an interval. When not specified the service uses
// DateTime.UtcNow
func (client MachinesClient) ListConnections(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListConnections")
defer func() {
sc := -1
if result.cc.Response.Response != nil {
sc = result.cc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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.NewError("servicemap.MachinesClient", "ListConnections", err.Error())
}
result.fn = client.listConnectionsNextResults
req, err := client.ListConnectionsPreparer(ctx, 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.cc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure sending request")
return
}
result.cc, err = client.ListConnectionsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListConnections", resp, "Failure responding to request")
return
}
if result.cc.hasNextLink() && result.cc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListConnectionsPreparer prepares the ListConnections request.
func (client MachinesClient) ListConnectionsPreparer(ctx context.Context, 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{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// 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,
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(ctx context.Context, lastResults ConnectionCollection) (result ConnectionCollection, err error) {
req, err := lastResults.connectionCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listConnectionsNextResults", 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", "listConnectionsNextResults", resp, "Failure sending next results request")
}
result, err = client.ListConnectionsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listConnectionsNextResults", resp, "Failure responding to next results request")
}
return
}
// ListConnectionsComplete enumerates all values, automatically crossing page boundaries as required.
func (client MachinesClient) ListConnectionsComplete(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result ConnectionCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListConnections")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListConnections(ctx, resourceGroupName, workspaceName, machineName, startTime, endTime)
return
}
// ListMachineGroupMembership returns a collection of machine groups this machine belongs to during the specified time
// interval.
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// machineName - machine resource name.
// startTime - UTC date and time specifying the start time of an interval. When not specified the service uses
// DateTime.UtcNow - 10m
// endTime - UTC date and time specifying the end time of an interval. When not specified the service uses
// DateTime.UtcNow
func (client MachinesClient) ListMachineGroupMembership(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result MachineGroupCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListMachineGroupMembership")
defer func() {
sc := -1
if result.mgc.Response.Response != nil {
sc = result.mgc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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.NewError("servicemap.MachinesClient", "ListMachineGroupMembership", err.Error())
}
result.fn = client.listMachineGroupMembershipNextResults
req, err := client.ListMachineGroupMembershipPreparer(ctx, resourceGroupName, workspaceName, machineName, startTime, endTime)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", nil, "Failure preparing request")
return
}
resp, err := client.ListMachineGroupMembershipSender(req)
if err != nil {
result.mgc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure sending request")
return
}
result.mgc, err = client.ListMachineGroupMembershipResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListMachineGroupMembership", resp, "Failure responding to request")
return
}
if result.mgc.hasNextLink() && result.mgc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListMachineGroupMembershipPreparer prepares the ListMachineGroupMembership request.
func (client MachinesClient) ListMachineGroupMembershipPreparer(ctx context.Context, 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}/machineGroups", pathParameters),
autorest.WithQueryParameters(queryParameters))
return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// 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,
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(ctx context.Context, lastResults MachineGroupCollection) (result MachineGroupCollection, err error) {
req, err := lastResults.machineGroupCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listMachineGroupMembershipNextResults", 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", "listMachineGroupMembershipNextResults", resp, "Failure sending next results request")
}
result, err = client.ListMachineGroupMembershipResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listMachineGroupMembershipNextResults", resp, "Failure responding to next results request")
}
return
}
// ListMachineGroupMembershipComplete enumerates all values, automatically crossing page boundaries as required.
func (client MachinesClient) ListMachineGroupMembershipComplete(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result MachineGroupCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListMachineGroupMembership")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListMachineGroupMembership(ctx, resourceGroupName, workspaceName, machineName, startTime, endTime)
return
}
// ListPorts returns a collection of live ports on the specified machine during the specified time interval.
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// machineName - machine resource name.
// startTime - UTC date and time specifying the start time of an interval. When not specified the service uses
// DateTime.UtcNow - 10m
// endTime - UTC date and time specifying the end time of an interval. When not specified the service uses
// DateTime.UtcNow
func (client MachinesClient) ListPorts(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result PortCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListPorts")
defer func() {
sc := -1
if result.pc.Response.Response != nil {
sc = result.pc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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.NewError("servicemap.MachinesClient", "ListPorts", err.Error())
}
result.fn = client.listPortsNextResults
req, err := client.ListPortsPreparer(ctx, 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.pc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure sending request")
return
}
result.pc, err = client.ListPortsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListPorts", resp, "Failure responding to request")
return
}
if result.pc.hasNextLink() && result.pc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListPortsPreparer prepares the ListPorts request.
func (client MachinesClient) ListPortsPreparer(ctx context.Context, 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{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// 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,
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(ctx context.Context, lastResults PortCollection) (result PortCollection, err error) {
req, err := lastResults.portCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listPortsNextResults", 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", "listPortsNextResults", resp, "Failure sending next results request")
}
result, err = client.ListPortsResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listPortsNextResults", resp, "Failure responding to next results request")
}
return
}
// ListPortsComplete enumerates all values, automatically crossing page boundaries as required.
func (client MachinesClient) ListPortsComplete(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, startTime *date.Time, endTime *date.Time) (result PortCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListPorts")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListPorts(ctx, resourceGroupName, workspaceName, machineName, startTime, endTime)
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).
// Parameters:
// resourceGroupName - resource group name within the specified subscriptionId.
// workspaceName - OMS workspace containing the resources of interest.
// machineName - machine resource name.
// live - 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 - UTC date and time specifying the start time of an interval. When not specified the service uses
// DateTime.UtcNow - 10m
// endTime - UTC date and time specifying the end time of an interval. When not specified the service uses
// DateTime.UtcNow
// timestamp - 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(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (result ProcessCollectionPage, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListProcesses")
defer func() {
sc := -1
if result.pc.Response.Response != nil {
sc = result.pc.Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
if err := validation.Validate([]validation.Validation{
{TargetValue: resourceGroupName,
Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 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.NewError("servicemap.MachinesClient", "ListProcesses", err.Error())
}
result.fn = client.listProcessesNextResults
req, err := client.ListProcessesPreparer(ctx, 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.pc.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure sending request")
return
}
result.pc, err = client.ListProcessesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "ListProcesses", resp, "Failure responding to request")
return
}
if result.pc.hasNextLink() && result.pc.IsEmpty() {
err = result.NextWithContext(ctx)
return
}
return
}
// ListProcessesPreparer prepares the ListProcesses request.
func (client MachinesClient) ListProcessesPreparer(ctx context.Context, 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)
} else {
queryParameters["live"] = autorest.Encode("query", true)
}
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{}).WithContext(ctx))
}
// 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 client.Send(req, azure.DoRetryWithRegistration(client.Client))
}
// 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,
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(ctx context.Context, lastResults ProcessCollection) (result ProcessCollection, err error) {
req, err := lastResults.processCollectionPreparer(ctx)
if err != nil {
return result, autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listProcessesNextResults", 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", "listProcessesNextResults", resp, "Failure sending next results request")
}
result, err = client.ListProcessesResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "servicemap.MachinesClient", "listProcessesNextResults", resp, "Failure responding to next results request")
}
return
}
// ListProcessesComplete enumerates all values, automatically crossing page boundaries as required.
func (client MachinesClient) ListProcessesComplete(ctx context.Context, resourceGroupName string, workspaceName string, machineName string, live *bool, startTime *date.Time, endTime *date.Time, timestamp *date.Time) (result ProcessCollectionIterator, err error) {
if tracing.IsEnabled() {
ctx = tracing.StartSpan(ctx, fqdn+"/MachinesClient.ListProcesses")
defer func() {
sc := -1
if result.Response().Response.Response != nil {
sc = result.page.Response().Response.Response.StatusCode
}
tracing.EndSpan(ctx, sc, err)
}()
}
result.page, err = client.ListProcesses(ctx, resourceGroupName, workspaceName, machineName, live, startTime, endTime, timestamp)
return
}
|