diff --git a/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go b/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go index 35f842ad958b..1384b68307a6 100644 --- a/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go +++ b/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go @@ -26,6 +26,7 @@ type AccountBillingRoleAssignmentClientAPI = original.AccountBillingRoleAssignme type AccountBillingRoleDefinitionClientAPI = original.AccountBillingRoleDefinitionClientAPI type AccountsClientAPI = original.AccountsClientAPI type AccountsWithCreateInvoiceSectionPermissionClientAPI = original.AccountsWithCreateInvoiceSectionPermissionClientAPI +type AgreementsClientAPI = original.AgreementsClientAPI type AvailableBalanceByBillingProfileClientAPI = original.AvailableBalanceByBillingProfileClientAPI type BaseClientAPI = original.BaseClientAPI type DepartmentsByBillingAccountNameClientAPI = original.DepartmentsByBillingAccountNameClientAPI @@ -60,4 +61,6 @@ type SubscriptionClientAPI = original.SubscriptionClientAPI type SubscriptionsByBillingProfileClientAPI = original.SubscriptionsByBillingProfileClientAPI type SubscriptionsByInvoiceSectionClientAPI = original.SubscriptionsByInvoiceSectionClientAPI type TransactionsByBillingAccountClientAPI = original.TransactionsByBillingAccountClientAPI +type TransactionsByBillingProfileClientAPI = original.TransactionsByBillingProfileClientAPI +type TransactionsByInvoiceSectionClientAPI = original.TransactionsByInvoiceSectionClientAPI type TransfersClientAPI = original.TransfersClientAPI diff --git a/profiles/preview/preview/billing/mgmt/billing/models.go b/profiles/preview/preview/billing/mgmt/billing/models.go index ace6c14a63d1..0bff360ec415 100644 --- a/profiles/preview/preview/billing/mgmt/billing/models.go +++ b/profiles/preview/preview/billing/mgmt/billing/models.go @@ -160,6 +160,10 @@ type AccountProperties = original.AccountProperties type AccountsClient = original.AccountsClient type AccountsWithCreateInvoiceSectionPermissionClient = original.AccountsWithCreateInvoiceSectionPermissionClient type Address = original.Address +type Agreement = original.Agreement +type AgreementListResult = original.AgreementListResult +type AgreementProperties = original.AgreementProperties +type AgreementsClient = original.AgreementsClient type Amount = original.Amount type AvailableBalance = original.AvailableBalance type AvailableBalanceByBillingProfileClient = original.AvailableBalanceByBillingProfileClient @@ -213,6 +217,7 @@ type OperationListResultIterator = original.OperationListResultIterator type OperationListResultPage = original.OperationListResultPage type OperationStatus = original.OperationStatus type OperationsClient = original.OperationsClient +type Participants = original.Participants type PaymentMethod = original.PaymentMethod type PaymentMethodProperties = original.PaymentMethodProperties type PaymentMethodsByBillingProfileClient = original.PaymentMethodsByBillingProfileClient @@ -270,6 +275,8 @@ type SubscriptionsListResult = original.SubscriptionsListResult type SubscriptionsListResultIterator = original.SubscriptionsListResultIterator type SubscriptionsListResultPage = original.SubscriptionsListResultPage type TransactionsByBillingAccountClient = original.TransactionsByBillingAccountClient +type TransactionsByBillingProfileClient = original.TransactionsByBillingProfileClient +type TransactionsByInvoiceSectionClient = original.TransactionsByInvoiceSectionClient type TransactionsListResult = original.TransactionsListResult type TransactionsListResultIterator = original.TransactionsListResultIterator type TransactionsListResultPage = original.TransactionsListResultPage @@ -323,6 +330,12 @@ func NewAccountsWithCreateInvoiceSectionPermissionClient(subscriptionID string) func NewAccountsWithCreateInvoiceSectionPermissionClientWithBaseURI(baseURI string, subscriptionID string) AccountsWithCreateInvoiceSectionPermissionClient { return original.NewAccountsWithCreateInvoiceSectionPermissionClientWithBaseURI(baseURI, subscriptionID) } +func NewAgreementsClient(subscriptionID string) AgreementsClient { + return original.NewAgreementsClient(subscriptionID) +} +func NewAgreementsClientWithBaseURI(baseURI string, subscriptionID string) AgreementsClient { + return original.NewAgreementsClientWithBaseURI(baseURI, subscriptionID) +} func NewAvailableBalanceByBillingProfileClient(subscriptionID string) AvailableBalanceByBillingProfileClient { return original.NewAvailableBalanceByBillingProfileClient(subscriptionID) } @@ -551,6 +564,18 @@ func NewTransactionsByBillingAccountClient(subscriptionID string) TransactionsBy func NewTransactionsByBillingAccountClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByBillingAccountClient { return original.NewTransactionsByBillingAccountClientWithBaseURI(baseURI, subscriptionID) } +func NewTransactionsByBillingProfileClient(subscriptionID string) TransactionsByBillingProfileClient { + return original.NewTransactionsByBillingProfileClient(subscriptionID) +} +func NewTransactionsByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByBillingProfileClient { + return original.NewTransactionsByBillingProfileClientWithBaseURI(baseURI, subscriptionID) +} +func NewTransactionsByInvoiceSectionClient(subscriptionID string) TransactionsByInvoiceSectionClient { + return original.NewTransactionsByInvoiceSectionClient(subscriptionID) +} +func NewTransactionsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByInvoiceSectionClient { + return original.NewTransactionsByInvoiceSectionClientWithBaseURI(baseURI, subscriptionID) +} func NewTransactionsListResultIterator(page TransactionsListResultPage) TransactionsListResultIterator { return original.NewTransactionsListResultIterator(page) } diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/agreements.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/agreements.go new file mode 100644 index 000000000000..32e3a7ff80a3 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/agreements.go @@ -0,0 +1,199 @@ +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" +) + +// AgreementsClient is the billing client provides access to billing resources for Azure subscriptions. +type AgreementsClient struct { + BaseClient +} + +// NewAgreementsClient creates an instance of the AgreementsClient client. +func NewAgreementsClient(subscriptionID string) AgreementsClient { + return NewAgreementsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewAgreementsClientWithBaseURI creates an instance of the AgreementsClient client. +func NewAgreementsClientWithBaseURI(baseURI string, subscriptionID string) AgreementsClient { + return AgreementsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the agreement by name. +// Parameters: +// billingAccountName - billing Account Id. +// agreementName - agreement Id. +// expand - may be used to expand the participants. +func (client AgreementsClient) Get(ctx context.Context, billingAccountName string, agreementName string, expand string) (result Agreement, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgreementsClient.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, billingAccountName, agreementName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AgreementsClient", "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.AgreementsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AgreementsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client AgreementsClient) GetPreparer(ctx context.Context, billingAccountName string, agreementName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "agreementName": autorest.Encode("path", agreementName), + "billingAccountName": autorest.Encode("path", billingAccountName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements/{agreementName}", 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 AgreementsClient) 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 AgreementsClient) GetResponder(resp *http.Response) (result Agreement, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBillingAccountName lists all agreements for a billing account. +// Parameters: +// billingAccountName - billing Account Id. +// expand - may be used to expand the participants. +func (client AgreementsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result AgreementListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/AgreementsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingAccountNamePreparer(ctx, billingAccountName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AgreementsClient", "ListByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.AgreementsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.AgreementsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client AgreementsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, expand string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + if len(expand) > 0 { + queryParameters["$expand"] = autorest.Encode("query", expand) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/agreements", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingAccountNameSender sends the ListByBillingAccountName request. The method will close the +// http.Response Body if it receives an error. +func (client AgreementsClient) ListByBillingAccountNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingAccountNameResponder handles the response to the ListByBillingAccountName request. The method always +// closes the http.Response Body. +func (client AgreementsClient) ListByBillingAccountNameResponder(resp *http.Response) (result AgreementListResult, 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/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go index d3977eaf4eb6..56756914c8b7 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi/interfaces.go @@ -25,7 +25,6 @@ import ( // BaseClientAPI contains the set of methods on the BaseClient type. type BaseClientAPI interface { - TransactionsByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (result billing.TransactionsListResult, err error) UpdateAutoRenewForBillingAccount(ctx context.Context, billingAccountName string, productName string, body billing.UpdateAutoRenewRequest) (result billing.UpdateAutoRenewOperationSummary, err error) UpdateAutoRenewForInvoiceSection(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body billing.UpdateAutoRenewRequest) (result billing.UpdateAutoRenewOperationSummary, err error) } @@ -215,6 +214,20 @@ type TransactionsByBillingAccountClientAPI interface { var _ TransactionsByBillingAccountClientAPI = (*billing.TransactionsByBillingAccountClient)(nil) +// TransactionsByBillingProfileClientAPI contains the set of methods on the TransactionsByBillingProfileClient type. +type TransactionsByBillingProfileClientAPI interface { + List(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (result billing.TransactionsListResult, err error) +} + +var _ TransactionsByBillingProfileClientAPI = (*billing.TransactionsByBillingProfileClient)(nil) + +// TransactionsByInvoiceSectionClientAPI contains the set of methods on the TransactionsByInvoiceSectionClient type. +type TransactionsByInvoiceSectionClientAPI interface { + List(ctx context.Context, billingAccountName string, invoiceSectionName string, startDate string, endDate string, filter string) (result billing.TransactionsListResult, err error) +} + +var _ TransactionsByInvoiceSectionClientAPI = (*billing.TransactionsByInvoiceSectionClient)(nil) + // PolicyClientAPI contains the set of methods on the PolicyClient type. type PolicyClientAPI interface { GetByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.Policy, err error) @@ -331,3 +344,11 @@ type ProfileBillingRoleAssignmentClientAPI interface { } var _ ProfileBillingRoleAssignmentClientAPI = (*billing.ProfileBillingRoleAssignmentClient)(nil) + +// AgreementsClientAPI contains the set of methods on the AgreementsClient type. +type AgreementsClientAPI interface { + Get(ctx context.Context, billingAccountName string, agreementName string, expand string) (result billing.Agreement, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result billing.AgreementListResult, err error) +} + +var _ AgreementsClientAPI = (*billing.AgreementsClient)(nil) diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/client.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/client.go index c554b2040e5a..89ab7df44a44 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/client.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/client.go @@ -54,92 +54,6 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { } } -// TransactionsByBillingProfile lists the transactions by billingProfileName for given start date and end date. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// startDate - start date -// endDate - end date -// filter - may be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and -// 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key -// and value is separated by a colon (:). -func (client BaseClient) TransactionsByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (result TransactionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.TransactionsByBillingProfile") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TransactionsByBillingProfilePreparer(ctx, billingAccountName, billingProfileName, startDate, endDate, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.BaseClient", "TransactionsByBillingProfile", nil, "Failure preparing request") - return - } - - resp, err := client.TransactionsByBillingProfileSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.BaseClient", "TransactionsByBillingProfile", resp, "Failure sending request") - return - } - - result, err = client.TransactionsByBillingProfileResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.BaseClient", "TransactionsByBillingProfile", resp, "Failure responding to request") - } - - return -} - -// TransactionsByBillingProfilePreparer prepares the TransactionsByBillingProfile request. -func (client BaseClient) TransactionsByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingProfileName": autorest.Encode("path", billingProfileName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - "endDate": autorest.Encode("query", endDate), - "startDate": autorest.Encode("query", startDate), - } - if len(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TransactionsByBillingProfileSender sends the TransactionsByBillingProfile request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) TransactionsByBillingProfileSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// TransactionsByBillingProfileResponder handles the response to the TransactionsByBillingProfile request. The method always -// closes the http.Response Body. -func (client BaseClient) TransactionsByBillingProfileResponder(resp *http.Response) (result TransactionsListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - // UpdateAutoRenewForBillingAccount cancel product by product id // Parameters: // billingAccountName - billing Account Id. diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go index 85c81de7c112..253eb5c49a01 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go @@ -470,6 +470,111 @@ type Address struct { PostalCode *string `json:"postalCode,omitempty"` } +// Agreement an agreement resource. +type Agreement struct { + autorest.Response `json:"-"` + // AgreementProperties - An agreement. + *AgreementProperties `json:"properties,omitempty"` + // ID - Resource Id. + ID *string `json:"id,omitempty"` + // Name - Resource name. + Name *string `json:"name,omitempty"` + // Type - Resource type. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for Agreement. +func (a Agreement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if a.AgreementProperties != nil { + objectMap["properties"] = a.AgreementProperties + } + if a.ID != nil { + objectMap["id"] = a.ID + } + if a.Name != nil { + objectMap["name"] = a.Name + } + if a.Type != nil { + objectMap["type"] = a.Type + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON is the custom unmarshaler for Agreement struct. +func (a *Agreement) UnmarshalJSON(body []byte) error { + var m map[string]*json.RawMessage + err := json.Unmarshal(body, &m) + if err != nil { + return err + } + for k, v := range m { + switch k { + case "properties": + if v != nil { + var agreementProperties AgreementProperties + err = json.Unmarshal(*v, &agreementProperties) + if err != nil { + return err + } + a.AgreementProperties = &agreementProperties + } + case "id": + if v != nil { + var ID string + err = json.Unmarshal(*v, &ID) + if err != nil { + return err + } + a.ID = &ID + } + case "name": + if v != nil { + var name string + err = json.Unmarshal(*v, &name) + if err != nil { + return err + } + a.Name = &name + } + case "type": + if v != nil { + var typeVar string + err = json.Unmarshal(*v, &typeVar) + if err != nil { + return err + } + a.Type = &typeVar + } + } + } + + return nil +} + +// AgreementListResult result of listing agreements. +type AgreementListResult struct { + autorest.Response `json:"-"` + // Value - The list of agreements. + Value *[]Agreement `json:"value,omitempty"` + // NextLink - The link (url) to the next page of results. + NextLink *string `json:"nextLink,omitempty"` +} + +// AgreementProperties the properties of the agreement. +type AgreementProperties struct { + // AgreementLink - The link to the agreement. + AgreementLink *string `json:"agreementLink,omitempty"` + // EffectiveDate - Effective date. + EffectiveDate *date.Time `json:"effectiveDate,omitempty"` + // ExpirationDate - Expiration date. + ExpirationDate *date.Time `json:"expirationDate,omitempty"` + // Participants - Participants or signer of the agreement. + Participants *[]Participants `json:"participants,omitempty"` + // Status - The agreement status + Status *string `json:"status,omitempty"` +} + // Amount the Amount. type Amount struct { // Currency - The currency for the amount value. @@ -1412,6 +1517,16 @@ type OperationStatus struct { StatusDetail *string `json:"statusDetail,omitempty"` } +// Participants details about the participant or signer. +type Participants struct { + // Status - The signing status + Status *string `json:"status,omitempty"` + // StatusDate - The date when status got changed. + StatusDate *date.Time `json:"statusDate,omitempty"` + // Email - The email address of the participant or signer. + Email *string `json:"email,omitempty"` +} + // PaymentMethod a payment method resource. type PaymentMethod struct { *PaymentMethodProperties `json:"properties,omitempty"` diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbybillingprofile.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbybillingprofile.go new file mode 100644 index 000000000000..104ce634b9cd --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbybillingprofile.go @@ -0,0 +1,129 @@ +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" +) + +// TransactionsByBillingProfileClient is the billing client provides access to billing resources for Azure +// subscriptions. +type TransactionsByBillingProfileClient struct { + BaseClient +} + +// NewTransactionsByBillingProfileClient creates an instance of the TransactionsByBillingProfileClient client. +func NewTransactionsByBillingProfileClient(subscriptionID string) TransactionsByBillingProfileClient { + return NewTransactionsByBillingProfileClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTransactionsByBillingProfileClientWithBaseURI creates an instance of the TransactionsByBillingProfileClient +// client. +func NewTransactionsByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByBillingProfileClient { + return TransactionsByBillingProfileClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the transactions by billingProfileName for given start date and end date. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// startDate - start date +// endDate - end date +// filter - may be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and +// 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key +// and value is separated by a colon (:). +func (client TransactionsByBillingProfileClient) List(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (result TransactionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsByBillingProfileClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, billingAccountName, billingProfileName, startDate, endDate, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingProfileClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingProfileClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingProfileClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TransactionsByBillingProfileClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingProfileName": autorest.Encode("path", billingProfileName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "endDate": autorest.Encode("query", endDate), + "startDate": autorest.Encode("query", startDate), + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/transactions", 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 TransactionsByBillingProfileClient) 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 TransactionsByBillingProfileClient) ListResponder(resp *http.Response) (result TransactionsListResult, 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/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbyinvoicesection.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbyinvoicesection.go new file mode 100644 index 000000000000..21de62d24528 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbyinvoicesection.go @@ -0,0 +1,129 @@ +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" +) + +// TransactionsByInvoiceSectionClient is the billing client provides access to billing resources for Azure +// subscriptions. +type TransactionsByInvoiceSectionClient struct { + BaseClient +} + +// NewTransactionsByInvoiceSectionClient creates an instance of the TransactionsByInvoiceSectionClient client. +func NewTransactionsByInvoiceSectionClient(subscriptionID string) TransactionsByInvoiceSectionClient { + return NewTransactionsByInvoiceSectionClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTransactionsByInvoiceSectionClientWithBaseURI creates an instance of the TransactionsByInvoiceSectionClient +// client. +func NewTransactionsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByInvoiceSectionClient { + return TransactionsByInvoiceSectionClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// List lists the transactions by invoiceSectionName for given start date and end date. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// startDate - start date +// endDate - end date +// filter - may be used to filter by transaction kind. The filter supports 'eq', 'lt', 'gt', 'le', 'ge', and +// 'and'. It does not currently support 'ne', 'or', or 'not'. Tag filter is a key value pair string where key +// and value is separated by a colon (:). +func (client TransactionsByInvoiceSectionClient) List(ctx context.Context, billingAccountName string, invoiceSectionName string, startDate string, endDate string, filter string) (result TransactionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsByInvoiceSectionClient.List") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListPreparer(ctx, billingAccountName, invoiceSectionName, startDate, endDate, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsByInvoiceSectionClient", "List", nil, "Failure preparing request") + return + } + + resp, err := client.ListSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.TransactionsByInvoiceSectionClient", "List", resp, "Failure sending request") + return + } + + result, err = client.ListResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsByInvoiceSectionClient", "List", resp, "Failure responding to request") + } + + return +} + +// ListPreparer prepares the List request. +func (client TransactionsByInvoiceSectionClient) ListPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, startDate string, endDate string, filter string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + "endDate": autorest.Encode("query", endDate), + "startDate": autorest.Encode("query", startDate), + } + if len(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/transactions", 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 TransactionsByInvoiceSectionClient) 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 TransactionsByInvoiceSectionClient) ListResponder(resp *http.Response) (result TransactionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +}