1package adhybridhealthservice 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 "github.com/Azure/go-autorest/tracing" 25 "net/http" 26) 27 28// ReportsClient is the REST APIs for Azure Active Directory Connect Health 29type ReportsClient struct { 30 BaseClient 31} 32 33// NewReportsClient creates an instance of the ReportsClient client. 34func NewReportsClient() ReportsClient { 35 return NewReportsClientWithBaseURI(DefaultBaseURI) 36} 37 38// NewReportsClientWithBaseURI creates an instance of the ReportsClient client. 39func NewReportsClientWithBaseURI(baseURI string) ReportsClient { 40 return ReportsClient{NewWithBaseURI(baseURI)} 41} 42 43// GetDevOps checks if the user is enabled for Dev Ops access. 44func (client ReportsClient) GetDevOps(ctx context.Context) (result Result, err error) { 45 if tracing.IsEnabled() { 46 ctx = tracing.StartSpan(ctx, fqdn+"/ReportsClient.GetDevOps") 47 defer func() { 48 sc := -1 49 if result.Response.Response != nil { 50 sc = result.Response.Response.StatusCode 51 } 52 tracing.EndSpan(ctx, sc, err) 53 }() 54 } 55 req, err := client.GetDevOpsPreparer(ctx) 56 if err != nil { 57 err = autorest.NewErrorWithError(err, "adhybridhealthservice.ReportsClient", "GetDevOps", nil, "Failure preparing request") 58 return 59 } 60 61 resp, err := client.GetDevOpsSender(req) 62 if err != nil { 63 result.Response = autorest.Response{Response: resp} 64 err = autorest.NewErrorWithError(err, "adhybridhealthservice.ReportsClient", "GetDevOps", resp, "Failure sending request") 65 return 66 } 67 68 result, err = client.GetDevOpsResponder(resp) 69 if err != nil { 70 err = autorest.NewErrorWithError(err, "adhybridhealthservice.ReportsClient", "GetDevOps", resp, "Failure responding to request") 71 } 72 73 return 74} 75 76// GetDevOpsPreparer prepares the GetDevOps request. 77func (client ReportsClient) GetDevOpsPreparer(ctx context.Context) (*http.Request, error) { 78 const APIVersion = "2014-01-01" 79 queryParameters := map[string]interface{}{ 80 "api-version": APIVersion, 81 } 82 83 preparer := autorest.CreatePreparer( 84 autorest.AsGet(), 85 autorest.WithBaseURL(client.BaseURI), 86 autorest.WithPath("/providers/Microsoft.ADHybridHealthService/reports/DevOps/IsDevOps"), 87 autorest.WithQueryParameters(queryParameters)) 88 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 89} 90 91// GetDevOpsSender sends the GetDevOps request. The method will close the 92// http.Response Body if it receives an error. 93func (client ReportsClient) GetDevOpsSender(req *http.Request) (*http.Response, error) { 94 sd := autorest.GetSendDecorators(req.Context(), autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) 95 return autorest.SendWithSender(client, req, sd...) 96} 97 98// GetDevOpsResponder handles the response to the GetDevOps request. The method always 99// closes the http.Response Body. 100func (client ReportsClient) GetDevOpsResponder(resp *http.Response) (result Result, err error) { 101 err = autorest.Respond( 102 resp, 103 client.ByInspecting(), 104 azure.WithErrorUnlessStatusCode(http.StatusOK), 105 autorest.ByUnmarshallingJSON(&result), 106 autorest.ByClosing()) 107 result.Response = autorest.Response{Response: resp} 108 return 109} 110