diff --git a/profiles/preview/adhybridhealthservice/mgmt/adhybridhealthservice/models.go b/profiles/preview/adhybridhealthservice/mgmt/adhybridhealthservice/models.go index d9564268b4b7..dda44b43808e 100644 --- a/profiles/preview/adhybridhealthservice/mgmt/adhybridhealthservice/models.go +++ b/profiles/preview/adhybridhealthservice/mgmt/adhybridhealthservice/models.go @@ -22,8 +22,12 @@ package adhybridhealthservice import original "github.com/Azure/azure-sdk-for-go/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice" type AdDomainServiceMembersClient = original.AdDomainServiceMembersClient +type AddsServiceClient = original.AddsServiceClient type AddsServiceMembersClient = original.AddsServiceMembersClient type AddsServicesClient = original.AddsServicesClient +type AddsServicesReplicationStatusClient = original.AddsServicesReplicationStatusClient +type AddsServicesServiceMembersClient = original.AddsServicesServiceMembersClient +type AddsServicesUserPreferenceClient = original.AddsServicesUserPreferenceClient type AlertsClient = original.AlertsClient const ( @@ -230,6 +234,7 @@ type Partition = original.Partition type PartitionScope = original.PartitionScope type PasswordHashSyncConfiguration = original.PasswordHashSyncConfiguration type PasswordManagementSettings = original.PasswordManagementSettings +type ReplicationDetailsList = original.ReplicationDetailsList type ReplicationStatus = original.ReplicationStatus type ReplicationSummary = original.ReplicationSummary type ReplicationSummaryList = original.ReplicationSummaryList @@ -250,8 +255,11 @@ type ServicesPage = original.ServicesPage type TabularExportError = original.TabularExportError type Tenant = original.Tenant type TenantOnboardingDetails = original.TenantOnboardingDetails +type UserPreference = original.UserPreference type ValueDelta = original.ValueDelta type OperationsClient = original.OperationsClient +type ReportsClient = original.ReportsClient +type ServiceClient = original.ServiceClient type ServiceMembersClient = original.ServiceMembersClient type ServicesClient = original.ServicesClient @@ -261,6 +269,12 @@ func NewAdDomainServiceMembersClient() AdDomainServiceMembersClient { func NewAdDomainServiceMembersClientWithBaseURI(baseURI string) AdDomainServiceMembersClient { return original.NewAdDomainServiceMembersClientWithBaseURI(baseURI) } +func NewAddsServiceClient() AddsServiceClient { + return original.NewAddsServiceClient() +} +func NewAddsServiceClientWithBaseURI(baseURI string) AddsServiceClient { + return original.NewAddsServiceClientWithBaseURI(baseURI) +} func NewAddsServiceMembersClient() AddsServiceMembersClient { return original.NewAddsServiceMembersClient() } @@ -273,6 +287,24 @@ func NewAddsServicesClient() AddsServicesClient { func NewAddsServicesClientWithBaseURI(baseURI string) AddsServicesClient { return original.NewAddsServicesClientWithBaseURI(baseURI) } +func NewAddsServicesReplicationStatusClient() AddsServicesReplicationStatusClient { + return original.NewAddsServicesReplicationStatusClient() +} +func NewAddsServicesReplicationStatusClientWithBaseURI(baseURI string) AddsServicesReplicationStatusClient { + return original.NewAddsServicesReplicationStatusClientWithBaseURI(baseURI) +} +func NewAddsServicesServiceMembersClient() AddsServicesServiceMembersClient { + return original.NewAddsServicesServiceMembersClient() +} +func NewAddsServicesServiceMembersClientWithBaseURI(baseURI string) AddsServicesServiceMembersClient { + return original.NewAddsServicesServiceMembersClientWithBaseURI(baseURI) +} +func NewAddsServicesUserPreferenceClient() AddsServicesUserPreferenceClient { + return original.NewAddsServicesUserPreferenceClient() +} +func NewAddsServicesUserPreferenceClientWithBaseURI(baseURI string) AddsServicesUserPreferenceClient { + return original.NewAddsServicesUserPreferenceClientWithBaseURI(baseURI) +} func NewAlertsClient() AlertsClient { return original.NewAlertsClient() } @@ -336,6 +368,18 @@ func NewOperationsClient() OperationsClient { func NewOperationsClientWithBaseURI(baseURI string) OperationsClient { return original.NewOperationsClientWithBaseURI(baseURI) } +func NewReportsClient() ReportsClient { + return original.NewReportsClient() +} +func NewReportsClientWithBaseURI(baseURI string) ReportsClient { + return original.NewReportsClientWithBaseURI(baseURI) +} +func NewServiceClient() ServiceClient { + return original.NewServiceClient() +} +func NewServiceClientWithBaseURI(baseURI string) ServiceClient { + return original.NewServiceClientWithBaseURI(baseURI) +} func NewServiceMembersClient() ServiceMembersClient { return original.NewServiceMembersClient() } diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservice.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservice.go new file mode 100644 index 000000000000..0a6be9446d4e --- /dev/null +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservice.go @@ -0,0 +1,121 @@ +package adhybridhealthservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "net/http" +) + +// AddsServiceClient is the REST APIs for Azure Active Drectory Connect Health +type AddsServiceClient struct { + BaseClient +} + +// NewAddsServiceClient creates an instance of the AddsServiceClient client. +func NewAddsServiceClient() AddsServiceClient { + return NewAddsServiceClientWithBaseURI(DefaultBaseURI) +} + +// NewAddsServiceClientWithBaseURI creates an instance of the AddsServiceClient client. +func NewAddsServiceClientWithBaseURI(baseURI string) AddsServiceClient { + return AddsServiceClient{NewWithBaseURI(baseURI)} +} + +// GetMetrics gets the server related metrics for a given metric and group combination. +// Parameters: +// serviceName - the name of the service. +// metricName - the metric name +// groupName - the group name +// groupKey - the group key +// fromDate - the start date. +// toDate - the end date. +func (client AddsServiceClient) GetMetrics(ctx context.Context, serviceName string, metricName string, groupName string, groupKey string, fromDate *date.Time, toDate *date.Time) (result MetricSets, err error) { + req, err := client.GetMetricsPreparer(ctx, serviceName, metricName, groupName, groupKey, fromDate, toDate) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceClient", "GetMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceClient", "GetMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceClient", "GetMetrics", resp, "Failure responding to request") + } + + return +} + +// GetMetricsPreparer prepares the GetMetrics request. +func (client AddsServiceClient) GetMetricsPreparer(ctx context.Context, serviceName string, metricName string, groupName string, groupKey string, fromDate *date.Time, toDate *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "metricName": autorest.Encode("path", metricName), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(groupKey) > 0 { + queryParameters["groupKey"] = autorest.Encode("query", groupKey) + } + if fromDate != nil { + queryParameters["fromDate"] = autorest.Encode("query", *fromDate) + } + if toDate != nil { + queryParameters["toDate"] = autorest.Encode("query", *toDate) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/metrics/{metricName}/groups/{groupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMetricsSender sends the GetMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServiceClient) GetMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetMetricsResponder handles the response to the GetMetrics request. The method always +// closes the http.Response Body. +func (client AddsServiceClient) GetMetricsResponder(resp *http.Response) (result MetricSets, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicemembers.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicemembers.go index e5ed7a9f875c..a7b884648efe 100644 --- a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicemembers.go +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicemembers.go @@ -21,6 +21,7 @@ import ( "context" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" + "github.com/satori/go.uuid" "net/http" ) @@ -39,6 +40,145 @@ func NewAddsServiceMembersClientWithBaseURI(baseURI string) AddsServiceMembersCl return AddsServiceMembersClient{NewWithBaseURI(baseURI)} } +// Delete deletes a Active Directory Domain Controller server that has been onboarded to Azure Active Directory Connect +// Health Service. +// Parameters: +// serviceName - the name of the service. +// serviceMemberID - the server Id. +// confirm - indicates if the server will be permanently deleted or disabled. True indicates that the server +// will be permanently deleted and False indicates that the server will be marked disabled and then deleted +// after 30 days, if it is not re-registered. +func (client AddsServiceMembersClient) Delete(ctx context.Context, serviceName string, serviceMemberID uuid.UUID, confirm *bool) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, serviceName, serviceMemberID, confirm) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AddsServiceMembersClient) DeletePreparer(ctx context.Context, serviceName string, serviceMemberID uuid.UUID, confirm *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceMemberId": autorest.Encode("path", serviceMemberID), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if confirm != nil { + queryParameters["confirm"] = autorest.Encode("query", *confirm) + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/servicemembers/{serviceMemberId}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServiceMembersClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AddsServiceMembersClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the details of a server, for a given Active Directory Domain Controller service, that are onboarded to +// Azure Active Directory Connect Health Service. +// Parameters: +// serviceName - the name of the service. +// serviceMemberID - the server Id. +func (client AddsServiceMembersClient) Get(ctx context.Context, serviceName string, serviceMemberID uuid.UUID) (result ServiceMember, err error) { + req, err := client.GetPreparer(ctx, serviceName, serviceMemberID) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AddsServiceMembersClient) GetPreparer(ctx context.Context, serviceName string, serviceMemberID uuid.UUID) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceMemberId": autorest.Encode("path", serviceMemberID), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/servicemembers/{serviceMemberId}", 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 AddsServiceMembersClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AddsServiceMembersClient) GetResponder(resp *http.Response) (result ServiceMember, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // List gets the details of the Active Directory Domain servers, for a given Active Directory Domain Service, that are // onboarded to Azure Active Directory Connect Health. // Parameters: @@ -135,3 +275,74 @@ func (client AddsServiceMembersClient) ListComplete(ctx context.Context, service result.page, err = client.List(ctx, serviceName, filter) return } + +// ListCredentials gets the credentials of the server which is needed by the agent to connect to Azure Active Directory +// Connect Health Service. +// Parameters: +// serviceName - the name of the service. +// serviceMemberID - the server Id. +// filter - the property filter to apply. +func (client AddsServiceMembersClient) ListCredentials(ctx context.Context, serviceName string, serviceMemberID uuid.UUID, filter string) (result Credentials, err error) { + req, err := client.ListCredentialsPreparer(ctx, serviceName, serviceMemberID, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "ListCredentials", nil, "Failure preparing request") + return + } + + resp, err := client.ListCredentialsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "ListCredentials", resp, "Failure sending request") + return + } + + result, err = client.ListCredentialsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServiceMembersClient", "ListCredentials", resp, "Failure responding to request") + } + + return +} + +// ListCredentialsPreparer prepares the ListCredentials request. +func (client AddsServiceMembersClient) ListCredentialsPreparer(ctx context.Context, serviceName string, serviceMemberID uuid.UUID, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceMemberId": autorest.Encode("path", serviceMemberID), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/servicemembers/{serviceMemberId}/credentials", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListCredentialsSender sends the ListCredentials request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServiceMembersClient) ListCredentialsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListCredentialsResponder handles the response to the ListCredentials request. The method always +// closes the http.Response Body. +func (client AddsServiceMembersClient) ListCredentialsResponder(resp *http.Response) (result Credentials, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservices.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservices.go index 934b14a4ca00..abec74f8ab22 100644 --- a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservices.go +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservices.go @@ -448,71 +448,6 @@ func (client AddsServicesClient) GetMetricMetadataForGroupResponder(resp *http.R return } -// GetReplicationStatus gets Replication status for a given Active Directory Domain Service, that is onboarded to Azure -// Active Directory Connect Health. -// Parameters: -// serviceName - the name of the service. -func (client AddsServicesClient) GetReplicationStatus(ctx context.Context, serviceName string) (result ReplicationStatus, err error) { - req, err := client.GetReplicationStatusPreparer(ctx, serviceName) - if err != nil { - err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesClient", "GetReplicationStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetReplicationStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesClient", "GetReplicationStatus", resp, "Failure sending request") - return - } - - result, err = client.GetReplicationStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesClient", "GetReplicationStatus", resp, "Failure responding to request") - } - - return -} - -// GetReplicationStatusPreparer prepares the GetReplicationStatus request. -func (client AddsServicesClient) GetReplicationStatusPreparer(ctx context.Context, serviceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "serviceName": autorest.Encode("path", serviceName), - } - - const APIVersion = "2014-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/replicationstatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetReplicationStatusSender sends the GetReplicationStatus request. The method will close the -// http.Response Body if it receives an error. -func (client AddsServicesClient) GetReplicationStatusSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// GetReplicationStatusResponder handles the response to the GetReplicationStatus request. The method always -// closes the http.Response Body. -func (client AddsServicesClient) GetReplicationStatusResponder(resp *http.Response) (result ReplicationStatus, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // List gets the details of Active Directory Domain Service, for a tenant, that are onboarded to Azure Active Directory // Connect Health. // Parameters: @@ -1019,6 +954,79 @@ func (client AddsServicesClient) ListPremiumServicesComplete(ctx context.Context return } +// ListReplicationDetails gets complete domain controller list along with replication details for a given Active +// Directory Domain Service, that is onboarded to Azure Active Directory Connect Health. +// Parameters: +// serviceName - the name of the service. +// filter - the server property filter to apply. +// withDetails - indicates if InboundReplicationNeighbor details are required or not. +func (client AddsServicesClient) ListReplicationDetails(ctx context.Context, serviceName string, filter string, withDetails *bool) (result ReplicationDetailsList, err error) { + req, err := client.ListReplicationDetailsPreparer(ctx, serviceName, filter, withDetails) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesClient", "ListReplicationDetails", nil, "Failure preparing request") + return + } + + resp, err := client.ListReplicationDetailsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesClient", "ListReplicationDetails", resp, "Failure sending request") + return + } + + result, err = client.ListReplicationDetailsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesClient", "ListReplicationDetails", resp, "Failure responding to request") + } + + return +} + +// ListReplicationDetailsPreparer prepares the ListReplicationDetails request. +func (client AddsServicesClient) ListReplicationDetailsPreparer(ctx context.Context, serviceName string, filter string, withDetails *bool) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if withDetails != nil { + queryParameters["withDetails"] = autorest.Encode("query", *withDetails) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/replicationdetails", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListReplicationDetailsSender sends the ListReplicationDetails request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServicesClient) ListReplicationDetailsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListReplicationDetailsResponder handles the response to the ListReplicationDetails request. The method always +// closes the http.Response Body. +func (client AddsServicesClient) ListReplicationDetailsResponder(resp *http.Response) (result ReplicationDetailsList, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListReplicationSummary gets complete domain controller list along with replication details for a given Active // Directory Domain Service, that is onboarded to Azure Active Directory Connect Health. // Parameters: diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesreplicationstatus.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesreplicationstatus.go new file mode 100644 index 000000000000..e93db2be3dee --- /dev/null +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesreplicationstatus.go @@ -0,0 +1,106 @@ +package adhybridhealthservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AddsServicesReplicationStatusClient is the REST APIs for Azure Active Drectory Connect Health +type AddsServicesReplicationStatusClient struct { + BaseClient +} + +// NewAddsServicesReplicationStatusClient creates an instance of the AddsServicesReplicationStatusClient client. +func NewAddsServicesReplicationStatusClient() AddsServicesReplicationStatusClient { + return NewAddsServicesReplicationStatusClientWithBaseURI(DefaultBaseURI) +} + +// NewAddsServicesReplicationStatusClientWithBaseURI creates an instance of the AddsServicesReplicationStatusClient +// client. +func NewAddsServicesReplicationStatusClientWithBaseURI(baseURI string) AddsServicesReplicationStatusClient { + return AddsServicesReplicationStatusClient{NewWithBaseURI(baseURI)} +} + +// Get gets Replication status for a given Active Directory Domain Service, that is onboarded to Azure Active Directory +// Connect Health. +// Parameters: +// serviceName - the name of the service. +func (client AddsServicesReplicationStatusClient) Get(ctx context.Context, serviceName string) (result ReplicationStatus, err error) { + req, err := client.GetPreparer(ctx, serviceName) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesReplicationStatusClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesReplicationStatusClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesReplicationStatusClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AddsServicesReplicationStatusClient) GetPreparer(ctx context.Context, serviceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/replicationstatus", 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 AddsServicesReplicationStatusClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AddsServicesReplicationStatusClient) GetResponder(resp *http.Response) (result ReplicationStatus, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesservicemembers.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesservicemembers.go new file mode 100644 index 000000000000..de5a61815bd6 --- /dev/null +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesservicemembers.go @@ -0,0 +1,213 @@ +package adhybridhealthservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AddsServicesServiceMembersClient is the REST APIs for Azure Active Drectory Connect Health +type AddsServicesServiceMembersClient struct { + BaseClient +} + +// NewAddsServicesServiceMembersClient creates an instance of the AddsServicesServiceMembersClient client. +func NewAddsServicesServiceMembersClient() AddsServicesServiceMembersClient { + return NewAddsServicesServiceMembersClientWithBaseURI(DefaultBaseURI) +} + +// NewAddsServicesServiceMembersClientWithBaseURI creates an instance of the AddsServicesServiceMembersClient client. +func NewAddsServicesServiceMembersClientWithBaseURI(baseURI string) AddsServicesServiceMembersClient { + return AddsServicesServiceMembersClient{NewWithBaseURI(baseURI)} +} + +// Add onboards a server, for a given Active Directory Domain Controller service, to Azure Active Directory Connect +// Health Service. +// Parameters: +// serviceName - the name of the service under which the server is to be onboarded. +// serviceMember - the server object. +func (client AddsServicesServiceMembersClient) Add(ctx context.Context, serviceName string, serviceMember ServiceMember) (result ServiceMember, err error) { + req, err := client.AddPreparer(ctx, serviceName, serviceMember) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client AddsServicesServiceMembersClient) AddPreparer(ctx context.Context, serviceName string, serviceMember ServiceMember) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/servicemembers", pathParameters), + autorest.WithJSON(serviceMember), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServicesServiceMembersClient) AddSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client AddsServicesServiceMembersClient) AddResponder(resp *http.Response) (result ServiceMember, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// List gets the details of the servers, for a given Active Directory Domain Controller service, that are onboarded to +// Azure Active Directory Connect Health Service. +// Parameters: +// serviceName - the name of the service. +// filter - the server property filter to apply. +// dimensionType - the server specific dimension. +// dimensionSignature - the value of the dimension. +func (client AddsServicesServiceMembersClient) List(ctx context.Context, serviceName string, filter string, dimensionType string, dimensionSignature string) (result ServiceMembersPage, err error) { + result.fn = client.listNextResults + req, err := client.ListPreparer(ctx, serviceName, filter, dimensionType, dimensionSignature) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.sm.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "List", resp, "Failure sending request") + return + } + + result.sm, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client AddsServicesServiceMembersClient) ListPreparer(ctx context.Context, serviceName string, filter string, dimensionType string, dimensionSignature string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + if len(dimensionType) > 0 { + queryParameters["dimensionType"] = autorest.Encode("query", dimensionType) + } + if len(dimensionSignature) > 0 { + queryParameters["dimensionSignature"] = autorest.Encode("query", dimensionSignature) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/servicemembers", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListSender sends the List request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServicesServiceMembersClient) ListSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListResponder handles the response to the List request. The method always +// closes the http.Response Body. +func (client AddsServicesServiceMembersClient) ListResponder(resp *http.Response) (result ServiceMembers, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listNextResults retrieves the next set of results, if any. +func (client AddsServicesServiceMembersClient) listNextResults(lastResults ServiceMembers) (result ServiceMembers, err error) { + req, err := lastResults.serviceMembersPreparer() + if err != nil { + return result, autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "listNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "listNextResults", resp, "Failure sending next results request") + } + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesServiceMembersClient", "listNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListComplete enumerates all values, automatically crossing page boundaries as required. +func (client AddsServicesServiceMembersClient) ListComplete(ctx context.Context, serviceName string, filter string, dimensionType string, dimensionSignature string) (result ServiceMembersIterator, err error) { + result.page, err = client.List(ctx, serviceName, filter, dimensionType, dimensionSignature) + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesuserpreference.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesuserpreference.go new file mode 100644 index 000000000000..da339bb29334 --- /dev/null +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/addsservicesuserpreference.go @@ -0,0 +1,239 @@ +package adhybridhealthservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// AddsServicesUserPreferenceClient is the REST APIs for Azure Active Drectory Connect Health +type AddsServicesUserPreferenceClient struct { + BaseClient +} + +// NewAddsServicesUserPreferenceClient creates an instance of the AddsServicesUserPreferenceClient client. +func NewAddsServicesUserPreferenceClient() AddsServicesUserPreferenceClient { + return NewAddsServicesUserPreferenceClientWithBaseURI(DefaultBaseURI) +} + +// NewAddsServicesUserPreferenceClientWithBaseURI creates an instance of the AddsServicesUserPreferenceClient client. +func NewAddsServicesUserPreferenceClientWithBaseURI(baseURI string) AddsServicesUserPreferenceClient { + return AddsServicesUserPreferenceClient{NewWithBaseURI(baseURI)} +} + +// Add adds the user preferences for a given feature. +// Parameters: +// serviceName - the name of the service. +// featureName - the name of the feature. +// setting - the user preference setting. +func (client AddsServicesUserPreferenceClient) Add(ctx context.Context, serviceName string, featureName string, setting UserPreference) (result autorest.Response, err error) { + req, err := client.AddPreparer(ctx, serviceName, featureName, setting) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Add", nil, "Failure preparing request") + return + } + + resp, err := client.AddSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Add", resp, "Failure sending request") + return + } + + result, err = client.AddResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Add", resp, "Failure responding to request") + } + + return +} + +// AddPreparer prepares the Add request. +func (client AddsServicesUserPreferenceClient) AddPreparer(ctx context.Context, serviceName string, featureName string, setting UserPreference) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "featureName": autorest.Encode("path", featureName), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/features/{featureName}/userpreference", pathParameters), + autorest.WithJSON(setting), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddSender sends the Add request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServicesUserPreferenceClient) AddSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddResponder handles the response to the Add request. The method always +// closes the http.Response Body. +func (client AddsServicesUserPreferenceClient) AddResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Delete deletes the user preferences for a given feature. +// Parameters: +// serviceName - the name of the service. +// featureName - the name of the feature. +func (client AddsServicesUserPreferenceClient) Delete(ctx context.Context, serviceName string, featureName string) (result autorest.Response, err error) { + req, err := client.DeletePreparer(ctx, serviceName, featureName) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Delete", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteSender(req) + if err != nil { + result.Response = resp + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Delete", resp, "Failure sending request") + return + } + + result, err = client.DeleteResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Delete", resp, "Failure responding to request") + } + + return +} + +// DeletePreparer prepares the Delete request. +func (client AddsServicesUserPreferenceClient) DeletePreparer(ctx context.Context, serviceName string, featureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "featureName": autorest.Encode("path", featureName), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/features/{featureName}/userpreference", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteSender sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (client AddsServicesUserPreferenceClient) DeleteSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteResponder handles the response to the Delete request. The method always +// closes the http.Response Body. +func (client AddsServicesUserPreferenceClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByClosing()) + result.Response = resp + return +} + +// Get gets the user preferences for a given feature. +// Parameters: +// serviceName - the name of the service. +// featureName - the name of the feature. +func (client AddsServicesUserPreferenceClient) Get(ctx context.Context, serviceName string, featureName string) (result UserPreference, err error) { + req, err := client.GetPreparer(ctx, serviceName, featureName) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Get", nil, "Failure preparing request") + return + } + + resp, err := client.GetSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.AddsServicesUserPreferenceClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AddsServicesUserPreferenceClient) GetPreparer(ctx context.Context, serviceName string, featureName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "featureName": autorest.Encode("path", featureName), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/addsservices/{serviceName}/features/{featureName}/userpreference", 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 AddsServicesUserPreferenceClient) GetSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetResponder handles the response to the Get request. The method always +// closes the http.Response Body. +func (client AddsServicesUserPreferenceClient) GetResponder(resp *http.Response) (result UserPreference, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/models.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/models.go index beba71acf31f..76e517e349b8 100644 --- a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/models.go +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/models.go @@ -2110,6 +2110,19 @@ type PasswordManagementSettings struct { UnlockAccount *bool `json:"unlockAccount,omitempty"` } +// ReplicationDetailsList the list of replication details. +type ReplicationDetailsList struct { + autorest.Response `json:"-"` + // Value - The value returned by the operation. + Value *[]ReplicationSummary `json:"value,omitempty"` + // TotalCount - The total count of replication detail elements. + TotalCount *int32 `json:"totalCount,omitempty"` + // ContinuationToken - The continuation token for paginated calls. + ContinuationToken *string `json:"continuationToken,omitempty"` + // NextLink - The link used to get the next page of operations. + NextLink *string `json:"nextLink,omitempty"` +} + // ReplicationStatus replication summary for a domain controller. type ReplicationStatus struct { autorest.Response `json:"-"` @@ -2613,6 +2626,13 @@ type TenantOnboardingDetails struct { OnboardingDisplayURL *string `json:"onboardingDisplayUrl,omitempty"` } +// UserPreference the user preference for a given feature. +type UserPreference struct { + autorest.Response `json:"-"` + // MetricNames - The name of the metric. + MetricNames *[]string `json:"metricNames,omitempty"` +} + // ValueDelta the value of the delta. type ValueDelta struct { // OperationType - The operation type. Possible values include: 'ValueDeltaOperationTypeUndefined', 'ValueDeltaOperationTypeAdd', 'ValueDeltaOperationTypeUpdate', 'ValueDeltaOperationTypeDelete' diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/reports.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/reports.go new file mode 100644 index 000000000000..0c25a2fc1ffd --- /dev/null +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/reports.go @@ -0,0 +1,98 @@ +package adhybridhealthservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "net/http" +) + +// ReportsClient is the REST APIs for Azure Active Drectory Connect Health +type ReportsClient struct { + BaseClient +} + +// NewReportsClient creates an instance of the ReportsClient client. +func NewReportsClient() ReportsClient { + return NewReportsClientWithBaseURI(DefaultBaseURI) +} + +// NewReportsClientWithBaseURI creates an instance of the ReportsClient client. +func NewReportsClientWithBaseURI(baseURI string) ReportsClient { + return ReportsClient{NewWithBaseURI(baseURI)} +} + +// GetDevOps checks if the user is enabled for Dev Ops access. +func (client ReportsClient) GetDevOps(ctx context.Context) (result Result, err error) { + req, err := client.GetDevOpsPreparer(ctx) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ReportsClient", "GetDevOps", nil, "Failure preparing request") + return + } + + resp, err := client.GetDevOpsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ReportsClient", "GetDevOps", resp, "Failure sending request") + return + } + + result, err = client.GetDevOpsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ReportsClient", "GetDevOps", resp, "Failure responding to request") + } + + return +} + +// GetDevOpsPreparer prepares the GetDevOps request. +func (client ReportsClient) GetDevOpsPreparer(ctx context.Context) (*http.Request, error) { + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPath("/providers/Microsoft.ADHybridHealthService/reports/DevOps/IsDevOps"), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetDevOpsSender sends the GetDevOps request. The method will close the +// http.Response Body if it receives an error. +func (client ReportsClient) GetDevOpsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetDevOpsResponder handles the response to the GetDevOps request. The method always +// closes the http.Response Body. +func (client ReportsClient) GetDevOpsResponder(resp *http.Response) (result Result, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/service.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/service.go new file mode 100644 index 000000000000..7b88067a603f --- /dev/null +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/service.go @@ -0,0 +1,121 @@ +package adhybridhealthservice + +// Copyright (c) Microsoft and contributors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "context" + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/date" + "net/http" +) + +// ServiceClient is the REST APIs for Azure Active Drectory Connect Health +type ServiceClient struct { + BaseClient +} + +// NewServiceClient creates an instance of the ServiceClient client. +func NewServiceClient() ServiceClient { + return NewServiceClientWithBaseURI(DefaultBaseURI) +} + +// NewServiceClientWithBaseURI creates an instance of the ServiceClient client. +func NewServiceClientWithBaseURI(baseURI string) ServiceClient { + return ServiceClient{NewWithBaseURI(baseURI)} +} + +// GetMetrics gets the server related metrics for a given metric and group combination. +// Parameters: +// serviceName - the name of the service. +// metricName - the metric name +// groupName - the group name +// groupKey - the group key +// fromDate - the start date. +// toDate - the end date. +func (client ServiceClient) GetMetrics(ctx context.Context, serviceName string, metricName string, groupName string, groupKey string, fromDate *date.Time, toDate *date.Time) (result MetricSets, err error) { + req, err := client.GetMetricsPreparer(ctx, serviceName, metricName, groupName, groupKey, fromDate, toDate) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceClient", "GetMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceClient", "GetMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceClient", "GetMetrics", resp, "Failure responding to request") + } + + return +} + +// GetMetricsPreparer prepares the GetMetrics request. +func (client ServiceClient) GetMetricsPreparer(ctx context.Context, serviceName string, metricName string, groupName string, groupKey string, fromDate *date.Time, toDate *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "metricName": autorest.Encode("path", metricName), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(groupKey) > 0 { + queryParameters["groupKey"] = autorest.Encode("query", groupKey) + } + if fromDate != nil { + queryParameters["fromDate"] = autorest.Encode("query", *fromDate) + } + if toDate != nil { + queryParameters["toDate"] = autorest.Encode("query", *toDate) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/metrics/{metricName}/groups/{groupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMetricsSender sends the GetMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceClient) GetMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetMetricsResponder handles the response to the GetMetrics request. The method always +// closes the http.Response Body. +func (client ServiceClient) GetMetricsResponder(resp *http.Response) (result MetricSets, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/servicemembers.go b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/servicemembers.go index 5ab001dacdd7..dd2ee6b62c6a 100644 --- a/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/servicemembers.go +++ b/services/adhybridhealthservice/mgmt/2014-01-01/adhybridhealthservice/servicemembers.go @@ -311,6 +311,88 @@ func (client ServiceMembersClient) GetResponder(resp *http.Response) (result Ser return } +// GetMetrics gets the server related metrics for a given metric and group combination. +// Parameters: +// serviceName - the name of the service. +// metricName - the metric name +// groupName - the group name +// serviceMemberID - the server id. +// groupKey - the group key +// fromDate - the start date. +// toDate - the end date. +func (client ServiceMembersClient) GetMetrics(ctx context.Context, serviceName string, metricName string, groupName string, serviceMemberID uuid.UUID, groupKey string, fromDate *date.Time, toDate *date.Time) (result MetricSets, err error) { + req, err := client.GetMetricsPreparer(ctx, serviceName, metricName, groupName, serviceMemberID, groupKey, fromDate, toDate) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceMembersClient", "GetMetrics", nil, "Failure preparing request") + return + } + + resp, err := client.GetMetricsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceMembersClient", "GetMetrics", resp, "Failure sending request") + return + } + + result, err = client.GetMetricsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceMembersClient", "GetMetrics", resp, "Failure responding to request") + } + + return +} + +// GetMetricsPreparer prepares the GetMetrics request. +func (client ServiceMembersClient) GetMetricsPreparer(ctx context.Context, serviceName string, metricName string, groupName string, serviceMemberID uuid.UUID, groupKey string, fromDate *date.Time, toDate *date.Time) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "groupName": autorest.Encode("path", groupName), + "metricName": autorest.Encode("path", metricName), + "serviceMemberId": autorest.Encode("path", serviceMemberID), + "serviceName": autorest.Encode("path", serviceName), + } + + const APIVersion = "2014-01-01" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(groupKey) > 0 { + queryParameters["groupKey"] = autorest.Encode("query", groupKey) + } + if fromDate != nil { + queryParameters["fromDate"] = autorest.Encode("query", *fromDate) + } + if toDate != nil { + queryParameters["toDate"] = autorest.Encode("query", *toDate) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/servicemembers/{serviceMemberId}/metrics/{metricName}/groups/{groupName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetMetricsSender sends the GetMetrics request. The method will close the +// http.Response Body if it receives an error. +func (client ServiceMembersClient) GetMetricsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetMetricsResponder handles the response to the GetMetrics request. The method always +// closes the http.Response Body. +func (client ServiceMembersClient) GetMetricsResponder(resp *http.Response) (result MetricSets, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // GetServiceConfiguration gets the service configuration. // Parameters: // serviceName - the name of the service. @@ -954,85 +1036,3 @@ func (client ServiceMembersClient) ListGlobalConfigurationResponder(resp *http.R result.Response = autorest.Response{Response: resp} return } - -// ListMetrics gets the server related metrics for a given metric and group combination. -// Parameters: -// serviceName - the name of the service. -// metricName - the metric name -// groupName - the group name -// serviceMemberID - the server id. -// groupKey - the group key -// fromDate - the start date. -// toDate - the end date. -func (client ServiceMembersClient) ListMetrics(ctx context.Context, serviceName string, metricName string, groupName string, serviceMemberID uuid.UUID, groupKey string, fromDate *date.Time, toDate *date.Time) (result MetricSets, err error) { - req, err := client.ListMetricsPreparer(ctx, serviceName, metricName, groupName, serviceMemberID, groupKey, fromDate, toDate) - if err != nil { - err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceMembersClient", "ListMetrics", nil, "Failure preparing request") - return - } - - resp, err := client.ListMetricsSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceMembersClient", "ListMetrics", resp, "Failure sending request") - return - } - - result, err = client.ListMetricsResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "adhybridhealthservice.ServiceMembersClient", "ListMetrics", resp, "Failure responding to request") - } - - return -} - -// ListMetricsPreparer prepares the ListMetrics request. -func (client ServiceMembersClient) ListMetricsPreparer(ctx context.Context, serviceName string, metricName string, groupName string, serviceMemberID uuid.UUID, groupKey string, fromDate *date.Time, toDate *date.Time) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "groupName": autorest.Encode("path", groupName), - "metricName": autorest.Encode("path", metricName), - "serviceMemberId": autorest.Encode("path", serviceMemberID), - "serviceName": autorest.Encode("path", serviceName), - } - - const APIVersion = "2014-01-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if len(groupKey) > 0 { - queryParameters["groupKey"] = autorest.Encode("query", groupKey) - } - if fromDate != nil { - queryParameters["fromDate"] = autorest.Encode("query", *fromDate) - } - if toDate != nil { - queryParameters["toDate"] = autorest.Encode("query", *toDate) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.ADHybridHealthService/services/{serviceName}/servicemembers/{serviceMemberId}/metrics/{metricName}/groups/{groupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListMetricsSender sends the ListMetrics request. The method will close the -// http.Response Body if it receives an error. -func (client ServiceMembersClient) ListMetricsSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListMetricsResponder handles the response to the ListMetrics request. The method always -// closes the http.Response Body. -func (client ServiceMembersClient) ListMetricsResponder(resp *http.Response) (result MetricSets, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -}