1package visualstudio
2
3// Copyright (c) Microsoft and contributors.  All rights reserved.
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13//
14// See the License for the specific language governing permissions and
15// limitations under the License.
16//
17// Code generated by Microsoft (R) AutoRest Code Generator.
18// Changes may cause incorrect behavior and will be lost if the code is regenerated.
19
20import (
21	"context"
22	"github.com/Azure/go-autorest/autorest"
23	"github.com/Azure/go-autorest/autorest/azure"
24	"net/http"
25)
26
27// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
28// OperationsClient is the use these APIs to manage Visual Studio Team Services resources through the Azure Resource
29// Manager. All task operations conform to the HTTP/1.1 protocol specification and each operation returns an
30// x-ms-request-id header that can be used to obtain information about the request. You must make sure that requests
31// made to these resources are secure. For more information, see https://docs.microsoft.com/en-us/rest/api/index.
32type OperationsClient struct {
33	BaseClient
34}
35
36// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
37// NewOperationsClient creates an instance of the OperationsClient client.
38func NewOperationsClient(subscriptionID string) OperationsClient {
39	return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID)
40}
41
42// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
43// NewOperationsClientWithBaseURI creates an instance of the OperationsClient client.
44func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient {
45	return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)}
46}
47
48// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
49// List gets the details of all operations possible on the Microsoft.VisualStudio resource provider.
50func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) {
51	req, err := client.ListPreparer(ctx)
52	if err != nil {
53		err = autorest.NewErrorWithError(err, "visualstudio.OperationsClient", "List", nil, "Failure preparing request")
54		return
55	}
56
57	resp, err := client.ListSender(req)
58	if err != nil {
59		result.Response = autorest.Response{Response: resp}
60		err = autorest.NewErrorWithError(err, "visualstudio.OperationsClient", "List", resp, "Failure sending request")
61		return
62	}
63
64	result, err = client.ListResponder(resp)
65	if err != nil {
66		err = autorest.NewErrorWithError(err, "visualstudio.OperationsClient", "List", resp, "Failure responding to request")
67	}
68
69	return
70}
71
72// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
73// ListPreparer prepares the List request.
74func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) {
75	preparer := autorest.CreatePreparer(
76		autorest.AsGet(),
77		autorest.WithBaseURL(client.BaseURI),
78		autorest.WithPath("/providers/microsoft.visualstudio/operations"))
79	return preparer.Prepare((&http.Request{}).WithContext(ctx))
80}
81
82// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
83// ListSender sends the List request. The method will close the
84// http.Response Body if it receives an error.
85func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) {
86	return autorest.SendWithSender(client, req,
87		autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
88}
89
90// Deprecated: Please use package github.com/Azure/azure-sdk-for-go/services/preview/visualstudio/mgmt/2014-04-01-preview/visualstudio instead.
91// ListResponder handles the response to the List request. The method always
92// closes the http.Response Body.
93func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, err error) {
94	err = autorest.Respond(
95		resp,
96		client.ByInspecting(),
97		azure.WithErrorUnlessStatusCode(http.StatusOK),
98		autorest.ByUnmarshallingJSON(&result),
99		autorest.ByClosing())
100	result.Response = autorest.Response{Response: resp}
101	return
102}
103