<commit_before>package billing

// 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/tracing"
	"net/http"
)

// TenantPropertiesClient is the billing client provides access to billing resources for Azure subscriptions.
type TenantPropertiesClient struct {
	BaseClient
}

// NewTenantPropertiesClient creates an instance of the TenantPropertiesClient client.
func NewTenantPropertiesClient(subscriptionID string) TenantPropertiesClient {
	return NewTenantPropertiesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}

// NewTenantPropertiesClientWithBaseURI creates an instance of the TenantPropertiesClient client.
func NewTenantPropertiesClientWithBaseURI(baseURI string, subscriptionID string) TenantPropertiesClient {
	return TenantPropertiesClient{NewWithBaseURI(baseURI, subscriptionID)}
}

// Get gets a Tenant Properties.
// Parameters:
// billingProfileID - billing Profile Id.
func (client TenantPropertiesClient) Get(ctx context.Context, billingProfileID string) (result TenantProperties, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TenantPropertiesClient.Get")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.GetPreparer(ctx, billingProfileID)
	if err != nil {
		err = autorest.NewErrorWithError(err, "billing.TenantPropertiesClient", "Get", nil, "Failure preparing request")
		return
	}

	resp, err := client.GetSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "billing.TenantPropertiesClient", "Get", resp, "Failure sending request")
		return
	}

	result, err = client.GetResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "billing.TenantPropertiesClient", "Get", resp, "Failure responding to request")
	}

	return
}

// GetPreparer prepares the Get request.
func (client TenantPropertiesClient) GetPreparer(ctx context.Context, billingProfileID string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"billingProfileId": autorest.Encode("path", billingProfileID),
	}

	const APIVersion = "2018-03-01-preview"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/providers/Microsoft.Billing/DiscoverTenants", 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 TenantPropertiesClient) 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 TenantPropertiesClient) GetResponder(resp *http.Response) (result TenantProperties, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())<commit_msg>Generated from c81e2130e29fae03a78cb1bfec7529ea6510ae1e<commit_after>package billing

// 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/tracing"
	"net/http"
)

// TenantPropertiesClient is the billing client provides access to billing resources for Azure subscriptions.
type TenantPropertiesClient struct {
	BaseClient
}

// NewTenantPropertiesClient creates an instance of the TenantPropertiesClient client.
func NewTenantPropertiesClient(subscriptionID string) TenantPropertiesClient {
	return NewTenantPropertiesClientWithBaseURI(DefaultBaseURI, subscriptionID)
}

// NewTenantPropertiesClientWithBaseURI creates an instance of the TenantPropertiesClient client.
func NewTenantPropertiesClientWithBaseURI(baseURI string, subscriptionID string) TenantPropertiesClient {
	return TenantPropertiesClient{NewWithBaseURI(baseURI, subscriptionID)}
}

// Get gets a Tenant Properties.
// Parameters:
// billingProfileID - billing Profile Id.
func (client TenantPropertiesClient) Get(ctx context.Context, billingProfileID string) (result TenantProperties, err error) {
	if tracing.IsEnabled() {
		ctx = tracing.StartSpan(ctx, fqdn+"/TenantPropertiesClient.Get")
		defer func() {
			sc := -1
			if result.Response.Response != nil {
				sc = result.Response.Response.StatusCode
			}
			tracing.EndSpan(ctx, sc, err)
		}()
	}
	req, err := client.GetPreparer(ctx, billingProfileID)
	if err != nil {
		err = autorest.NewErrorWithError(err, "billing.TenantPropertiesClient", "Get", nil, "Failure preparing request")
		return
	}

	resp, err := client.GetSender(req)
	if err != nil {
		result.Response = autorest.Response{Response: resp}
		err = autorest.NewErrorWithError(err, "billing.TenantPropertiesClient", "Get", resp, "Failure sending request")
		return
	}

	result, err = client.GetResponder(resp)
	if err != nil {
		err = autorest.NewErrorWithError(err, "billing.TenantPropertiesClient", "Get", resp, "Failure responding to request")
	}

	return
}

// GetPreparer prepares the Get request.
func (client TenantPropertiesClient) GetPreparer(ctx context.Context, billingProfileID string) (*http.Request, error) {
	pathParameters := map[string]interface{}{
		"billingProfileId": autorest.Encode("path", billingProfileID),
	}

	const APIVersion = "2018-03-01-preview"
	queryParameters := map[string]interface{}{
		"api-version": APIVersion,
	}

	preparer := autorest.CreatePreparer(
		autorest.AsGet(),
		autorest.WithBaseURL(client.BaseURI),
		autorest.WithPathParameters("/providers/Microsoft.Billing/discoverTenants", 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 TenantPropertiesClient) 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 TenantPropertiesClient) GetResponder(resp *http.Response) (result TenantProperties, err error) {
	err = autorest.Respond(
		resp,
		client.ByInspecting(),
		azure.WithErrorUnlessStatusCode(http.StatusOK),
		autorest.ByUnmarshallingJSON(&result),
		autorest.ByClosing())
{'fraction_non_alphanumeric': 0.10236406619385342, 'fraction_numerical': 0.005673758865248227, 'mean_word_length': 5.1534545454545455, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5031389', 'n_tokens_mistral': 2542, 'n_tokens_neox': 2424, 'n_words': 699}