diff --git a/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go b/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go index cfec3dc55496..133b14bbd6bc 100644 --- a/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go +++ b/profiles/preview/preview/billing/mgmt/billing/billingapi/models.go @@ -21,45 +21,24 @@ package billingapi import original "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/2018-11-01-preview/billing/billingapi" -type AccountBillingPermissionsClientAPI = original.AccountBillingPermissionsClientAPI -type AccountBillingRoleAssignmentClientAPI = original.AccountBillingRoleAssignmentClientAPI -type AccountBillingRoleDefinitionClientAPI = original.AccountBillingRoleDefinitionClientAPI type AccountsClientAPI = original.AccountsClientAPI type AgreementsClientAPI = original.AgreementsClientAPI -type AvailableBalanceByBillingProfileClientAPI = original.AvailableBalanceByBillingProfileClientAPI -type BaseClientAPI = original.BaseClientAPI -type DepartmentsByBillingAccountNameClientAPI = original.DepartmentsByBillingAccountNameClientAPI +type AvailableBalancesClientAPI = original.AvailableBalancesClientAPI type DepartmentsClientAPI = original.DepartmentsClientAPI -type EnrollmentAccountsByBillingAccountNameClientAPI = original.EnrollmentAccountsByBillingAccountNameClientAPI type EnrollmentAccountsClientAPI = original.EnrollmentAccountsClientAPI -type InvoiceClientAPI = original.InvoiceClientAPI -type InvoicePricesheetClientAPI = original.InvoicePricesheetClientAPI -type InvoiceSectionBillingRoleAssignmentClientAPI = original.InvoiceSectionBillingRoleAssignmentClientAPI -type InvoiceSectionBillingRoleDefinitionClientAPI = original.InvoiceSectionBillingRoleDefinitionClientAPI -type InvoiceSectionsBillingPermissionsClientAPI = original.InvoiceSectionsBillingPermissionsClientAPI -type InvoiceSectionsByBillingAccountNameClientAPI = original.InvoiceSectionsByBillingAccountNameClientAPI type InvoiceSectionsClientAPI = original.InvoiceSectionsClientAPI -type InvoiceSectionsWithCreateSubscriptionPermissionClientAPI = original.InvoiceSectionsWithCreateSubscriptionPermissionClientAPI -type InvoicesByBillingAccountClientAPI = original.InvoicesByBillingAccountClientAPI -type InvoicesByBillingProfileClientAPI = original.InvoicesByBillingProfileClientAPI +type InvoicesClientAPI = original.InvoicesClientAPI type OperationsClientAPI = original.OperationsClientAPI -type PaymentMethodsByBillingProfileClientAPI = original.PaymentMethodsByBillingProfileClientAPI -type PolicyClientAPI = original.PolicyClientAPI -type ProductsByBillingAccountClientAPI = original.ProductsByBillingAccountClientAPI -type ProductsByBillingSubscriptionsClientAPI = original.ProductsByBillingSubscriptionsClientAPI -type ProductsByInvoiceSectionClientAPI = original.ProductsByInvoiceSectionClientAPI +type PaymentMethodsClientAPI = original.PaymentMethodsClientAPI +type PermissionsClientAPI = original.PermissionsClientAPI +type PoliciesClientAPI = original.PoliciesClientAPI +type PriceSheetClientAPI = original.PriceSheetClientAPI type ProductsClientAPI = original.ProductsClientAPI -type ProfileBillingPermissionsClientAPI = original.ProfileBillingPermissionsClientAPI -type ProfileBillingRoleAssignmentClientAPI = original.ProfileBillingRoleAssignmentClientAPI -type ProfileBillingRoleDefinitionClientAPI = original.ProfileBillingRoleDefinitionClientAPI -type ProfilesByBillingAccountNameClientAPI = original.ProfilesByBillingAccountNameClientAPI type ProfilesClientAPI = original.ProfilesClientAPI type PropertyClientAPI = original.PropertyClientAPI type RecipientTransfersClientAPI = original.RecipientTransfersClientAPI -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 RoleAssignmentsClientAPI = original.RoleAssignmentsClientAPI +type RoleDefinitionsClientAPI = original.RoleDefinitionsClientAPI +type SubscriptionsClientAPI = original.SubscriptionsClientAPI +type TransactionsClientAPI = original.TransactionsClientAPI 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 cd715a15c9f6..055b44493e6e 100644 --- a/profiles/preview/preview/billing/mgmt/billing/models.go +++ b/profiles/preview/preview/billing/mgmt/billing/models.go @@ -152,9 +152,6 @@ const ( type AcceptTransferProperties = original.AcceptTransferProperties type AcceptTransferRequest = original.AcceptTransferRequest type Account = original.Account -type AccountBillingPermissionsClient = original.AccountBillingPermissionsClient -type AccountBillingRoleAssignmentClient = original.AccountBillingRoleAssignmentClient -type AccountBillingRoleDefinitionClient = original.AccountBillingRoleDefinitionClient type AccountListResult = original.AccountListResult type AccountProperties = original.AccountProperties type AccountsClient = original.AccountsClient @@ -165,13 +162,12 @@ type AgreementProperties = original.AgreementProperties type AgreementsClient = original.AgreementsClient type Amount = original.Amount type AvailableBalance = original.AvailableBalance -type AvailableBalanceByBillingProfileClient = original.AvailableBalanceByBillingProfileClient type AvailableBalanceProperties = original.AvailableBalanceProperties +type AvailableBalancesClient = original.AvailableBalancesClient type BaseClient = original.BaseClient type Department = original.Department type DepartmentListResult = original.DepartmentListResult type DepartmentProperties = original.DepartmentProperties -type DepartmentsByBillingAccountNameClient = original.DepartmentsByBillingAccountNameClient type DepartmentsClient = original.DepartmentsClient type DetailedTransferStatus = original.DetailedTransferStatus type DownloadProperties = original.DownloadProperties @@ -182,7 +178,6 @@ type EnrollmentAccount = original.EnrollmentAccount type EnrollmentAccountContext = original.EnrollmentAccountContext type EnrollmentAccountListResult = original.EnrollmentAccountListResult type EnrollmentAccountProperties = original.EnrollmentAccountProperties -type EnrollmentAccountsByBillingAccountNameClient = original.EnrollmentAccountsByBillingAccountNameClient type EnrollmentAccountsClient = original.EnrollmentAccountsClient type EnrollmentPolicies = original.EnrollmentPolicies type Error = original.Error @@ -190,25 +185,16 @@ type ErrorDetails = original.ErrorDetails type ErrorResponse = original.ErrorResponse type InitiateTransferProperties = original.InitiateTransferProperties type InitiateTransferRequest = original.InitiateTransferRequest -type InvoiceClient = original.InvoiceClient type InvoiceListResult = original.InvoiceListResult -type InvoicePricesheetClient = original.InvoicePricesheetClient -type InvoicePricesheetDownloadFuture = original.InvoicePricesheetDownloadFuture type InvoiceSection = original.InvoiceSection -type InvoiceSectionBillingRoleAssignmentClient = original.InvoiceSectionBillingRoleAssignmentClient -type InvoiceSectionBillingRoleDefinitionClient = original.InvoiceSectionBillingRoleDefinitionClient type InvoiceSectionListResult = original.InvoiceSectionListResult type InvoiceSectionProperties = original.InvoiceSectionProperties -type InvoiceSectionsBillingPermissionsClient = original.InvoiceSectionsBillingPermissionsClient -type InvoiceSectionsByBillingAccountNameClient = original.InvoiceSectionsByBillingAccountNameClient type InvoiceSectionsClient = original.InvoiceSectionsClient type InvoiceSectionsCreateFuture = original.InvoiceSectionsCreateFuture type InvoiceSectionsUpdateFuture = original.InvoiceSectionsUpdateFuture -type InvoiceSectionsWithCreateSubscriptionPermissionClient = original.InvoiceSectionsWithCreateSubscriptionPermissionClient type InvoiceSummary = original.InvoiceSummary type InvoiceSummaryProperties = original.InvoiceSummaryProperties -type InvoicesByBillingAccountClient = original.InvoicesByBillingAccountClient -type InvoicesByBillingProfileClient = original.InvoicesByBillingProfileClient +type InvoicesClient = original.InvoicesClient type Operation = original.Operation type OperationDisplay = original.OperationDisplay type OperationListResult = original.OperationListResult @@ -219,33 +205,29 @@ type OperationsClient = original.OperationsClient type Participants = original.Participants type PaymentMethod = original.PaymentMethod type PaymentMethodProperties = original.PaymentMethodProperties -type PaymentMethodsByBillingProfileClient = original.PaymentMethodsByBillingProfileClient +type PaymentMethodsClient = original.PaymentMethodsClient type PaymentMethodsListResult = original.PaymentMethodsListResult type PaymentMethodsListResultIterator = original.PaymentMethodsListResultIterator type PaymentMethodsListResultPage = original.PaymentMethodsListResultPage type PaymentProperties = original.PaymentProperties -type Permissions = original.Permissions +type PermissionsClient = original.PermissionsClient type PermissionsListResult = original.PermissionsListResult +type PermissionsProperties = original.PermissionsProperties +type PoliciesClient = original.PoliciesClient type Policy = original.Policy -type PolicyClient = original.PolicyClient type PolicyProperties = original.PolicyProperties +type PriceSheetClient = original.PriceSheetClient +type PriceSheetDownloadFuture = original.PriceSheetDownloadFuture type ProductDetails = original.ProductDetails type ProductSummary = original.ProductSummary type ProductSummaryProperties = original.ProductSummaryProperties -type ProductsByBillingAccountClient = original.ProductsByBillingAccountClient -type ProductsByBillingSubscriptionsClient = original.ProductsByBillingSubscriptionsClient -type ProductsByInvoiceSectionClient = original.ProductsByInvoiceSectionClient type ProductsClient = original.ProductsClient type ProductsListResult = original.ProductsListResult type ProductsListResultIterator = original.ProductsListResultIterator type ProductsListResultPage = original.ProductsListResultPage type Profile = original.Profile -type ProfileBillingPermissionsClient = original.ProfileBillingPermissionsClient -type ProfileBillingRoleAssignmentClient = original.ProfileBillingRoleAssignmentClient -type ProfileBillingRoleDefinitionClient = original.ProfileBillingRoleDefinitionClient type ProfileListResult = original.ProfileListResult type ProfileProperties = original.ProfileProperties -type ProfilesByBillingAccountNameClient = original.ProfilesByBillingAccountNameClient type ProfilesClient = original.ProfilesClient type ProfilesUpdateFuture = original.ProfilesUpdateFuture type Property = original.Property @@ -262,21 +244,19 @@ type RoleAssignment = original.RoleAssignment type RoleAssignmentListResult = original.RoleAssignmentListResult type RoleAssignmentPayload = original.RoleAssignmentPayload type RoleAssignmentProperties = original.RoleAssignmentProperties +type RoleAssignmentsClient = original.RoleAssignmentsClient type RoleDefinition = original.RoleDefinition type RoleDefinitionListResult = original.RoleDefinitionListResult type RoleDefinitionProperties = original.RoleDefinitionProperties -type SubscriptionClient = original.SubscriptionClient +type RoleDefinitionsClient = original.RoleDefinitionsClient type SubscriptionProperties = original.SubscriptionProperties type SubscriptionSummary = original.SubscriptionSummary -type SubscriptionTransferFuture = original.SubscriptionTransferFuture -type SubscriptionsByBillingProfileClient = original.SubscriptionsByBillingProfileClient -type SubscriptionsByInvoiceSectionClient = original.SubscriptionsByInvoiceSectionClient +type SubscriptionsClient = original.SubscriptionsClient 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 SubscriptionsTransferFuture = original.SubscriptionsTransferFuture +type TransactionsClient = original.TransactionsClient type TransactionsListResult = original.TransactionsListResult type TransactionsListResultIterator = original.TransactionsListResultIterator type TransactionsListResultPage = original.TransactionsListResultPage @@ -300,24 +280,6 @@ type UpdateAutoRenewRequest = original.UpdateAutoRenewRequest func New(subscriptionID string) BaseClient { return original.New(subscriptionID) } -func NewAccountBillingPermissionsClient(subscriptionID string) AccountBillingPermissionsClient { - return original.NewAccountBillingPermissionsClient(subscriptionID) -} -func NewAccountBillingPermissionsClientWithBaseURI(baseURI string, subscriptionID string) AccountBillingPermissionsClient { - return original.NewAccountBillingPermissionsClientWithBaseURI(baseURI, subscriptionID) -} -func NewAccountBillingRoleAssignmentClient(subscriptionID string) AccountBillingRoleAssignmentClient { - return original.NewAccountBillingRoleAssignmentClient(subscriptionID) -} -func NewAccountBillingRoleAssignmentClientWithBaseURI(baseURI string, subscriptionID string) AccountBillingRoleAssignmentClient { - return original.NewAccountBillingRoleAssignmentClientWithBaseURI(baseURI, subscriptionID) -} -func NewAccountBillingRoleDefinitionClient(subscriptionID string) AccountBillingRoleDefinitionClient { - return original.NewAccountBillingRoleDefinitionClient(subscriptionID) -} -func NewAccountBillingRoleDefinitionClientWithBaseURI(baseURI string, subscriptionID string) AccountBillingRoleDefinitionClient { - return original.NewAccountBillingRoleDefinitionClientWithBaseURI(baseURI, subscriptionID) -} func NewAccountsClient(subscriptionID string) AccountsClient { return original.NewAccountsClient(subscriptionID) } @@ -330,17 +292,11 @@ func NewAgreementsClient(subscriptionID string) AgreementsClient { func NewAgreementsClientWithBaseURI(baseURI string, subscriptionID string) AgreementsClient { return original.NewAgreementsClientWithBaseURI(baseURI, subscriptionID) } -func NewAvailableBalanceByBillingProfileClient(subscriptionID string) AvailableBalanceByBillingProfileClient { - return original.NewAvailableBalanceByBillingProfileClient(subscriptionID) -} -func NewAvailableBalanceByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) AvailableBalanceByBillingProfileClient { - return original.NewAvailableBalanceByBillingProfileClientWithBaseURI(baseURI, subscriptionID) -} -func NewDepartmentsByBillingAccountNameClient(subscriptionID string) DepartmentsByBillingAccountNameClient { - return original.NewDepartmentsByBillingAccountNameClient(subscriptionID) +func NewAvailableBalancesClient(subscriptionID string) AvailableBalancesClient { + return original.NewAvailableBalancesClient(subscriptionID) } -func NewDepartmentsByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) DepartmentsByBillingAccountNameClient { - return original.NewDepartmentsByBillingAccountNameClientWithBaseURI(baseURI, subscriptionID) +func NewAvailableBalancesClientWithBaseURI(baseURI string, subscriptionID string) AvailableBalancesClient { + return original.NewAvailableBalancesClientWithBaseURI(baseURI, subscriptionID) } func NewDepartmentsClient(subscriptionID string) DepartmentsClient { return original.NewDepartmentsClient(subscriptionID) @@ -348,77 +304,23 @@ func NewDepartmentsClient(subscriptionID string) DepartmentsClient { func NewDepartmentsClientWithBaseURI(baseURI string, subscriptionID string) DepartmentsClient { return original.NewDepartmentsClientWithBaseURI(baseURI, subscriptionID) } -func NewEnrollmentAccountsByBillingAccountNameClient(subscriptionID string) EnrollmentAccountsByBillingAccountNameClient { - return original.NewEnrollmentAccountsByBillingAccountNameClient(subscriptionID) -} -func NewEnrollmentAccountsByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) EnrollmentAccountsByBillingAccountNameClient { - return original.NewEnrollmentAccountsByBillingAccountNameClientWithBaseURI(baseURI, subscriptionID) -} func NewEnrollmentAccountsClient(subscriptionID string) EnrollmentAccountsClient { return original.NewEnrollmentAccountsClient(subscriptionID) } func NewEnrollmentAccountsClientWithBaseURI(baseURI string, subscriptionID string) EnrollmentAccountsClient { return original.NewEnrollmentAccountsClientWithBaseURI(baseURI, subscriptionID) } -func NewInvoiceClient(subscriptionID string) InvoiceClient { - return original.NewInvoiceClient(subscriptionID) -} -func NewInvoiceClientWithBaseURI(baseURI string, subscriptionID string) InvoiceClient { - return original.NewInvoiceClientWithBaseURI(baseURI, subscriptionID) -} -func NewInvoicePricesheetClient(subscriptionID string) InvoicePricesheetClient { - return original.NewInvoicePricesheetClient(subscriptionID) -} -func NewInvoicePricesheetClientWithBaseURI(baseURI string, subscriptionID string) InvoicePricesheetClient { - return original.NewInvoicePricesheetClientWithBaseURI(baseURI, subscriptionID) -} -func NewInvoiceSectionBillingRoleAssignmentClient(subscriptionID string) InvoiceSectionBillingRoleAssignmentClient { - return original.NewInvoiceSectionBillingRoleAssignmentClient(subscriptionID) -} -func NewInvoiceSectionBillingRoleAssignmentClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionBillingRoleAssignmentClient { - return original.NewInvoiceSectionBillingRoleAssignmentClientWithBaseURI(baseURI, subscriptionID) -} -func NewInvoiceSectionBillingRoleDefinitionClient(subscriptionID string) InvoiceSectionBillingRoleDefinitionClient { - return original.NewInvoiceSectionBillingRoleDefinitionClient(subscriptionID) -} -func NewInvoiceSectionBillingRoleDefinitionClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionBillingRoleDefinitionClient { - return original.NewInvoiceSectionBillingRoleDefinitionClientWithBaseURI(baseURI, subscriptionID) -} -func NewInvoiceSectionsBillingPermissionsClient(subscriptionID string) InvoiceSectionsBillingPermissionsClient { - return original.NewInvoiceSectionsBillingPermissionsClient(subscriptionID) -} -func NewInvoiceSectionsBillingPermissionsClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsBillingPermissionsClient { - return original.NewInvoiceSectionsBillingPermissionsClientWithBaseURI(baseURI, subscriptionID) -} -func NewInvoiceSectionsByBillingAccountNameClient(subscriptionID string) InvoiceSectionsByBillingAccountNameClient { - return original.NewInvoiceSectionsByBillingAccountNameClient(subscriptionID) -} -func NewInvoiceSectionsByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsByBillingAccountNameClient { - return original.NewInvoiceSectionsByBillingAccountNameClientWithBaseURI(baseURI, subscriptionID) -} func NewInvoiceSectionsClient(subscriptionID string) InvoiceSectionsClient { return original.NewInvoiceSectionsClient(subscriptionID) } func NewInvoiceSectionsClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsClient { return original.NewInvoiceSectionsClientWithBaseURI(baseURI, subscriptionID) } -func NewInvoiceSectionsWithCreateSubscriptionPermissionClient(subscriptionID string) InvoiceSectionsWithCreateSubscriptionPermissionClient { - return original.NewInvoiceSectionsWithCreateSubscriptionPermissionClient(subscriptionID) -} -func NewInvoiceSectionsWithCreateSubscriptionPermissionClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsWithCreateSubscriptionPermissionClient { - return original.NewInvoiceSectionsWithCreateSubscriptionPermissionClientWithBaseURI(baseURI, subscriptionID) -} -func NewInvoicesByBillingAccountClient(subscriptionID string) InvoicesByBillingAccountClient { - return original.NewInvoicesByBillingAccountClient(subscriptionID) -} -func NewInvoicesByBillingAccountClientWithBaseURI(baseURI string, subscriptionID string) InvoicesByBillingAccountClient { - return original.NewInvoicesByBillingAccountClientWithBaseURI(baseURI, subscriptionID) +func NewInvoicesClient(subscriptionID string) InvoicesClient { + return original.NewInvoicesClient(subscriptionID) } -func NewInvoicesByBillingProfileClient(subscriptionID string) InvoicesByBillingProfileClient { - return original.NewInvoicesByBillingProfileClient(subscriptionID) -} -func NewInvoicesByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) InvoicesByBillingProfileClient { - return original.NewInvoicesByBillingProfileClientWithBaseURI(baseURI, subscriptionID) +func NewInvoicesClientWithBaseURI(baseURI string, subscriptionID string) InvoicesClient { + return original.NewInvoicesClientWithBaseURI(baseURI, subscriptionID) } func NewOperationListResultIterator(page OperationListResultPage) OperationListResultIterator { return original.NewOperationListResultIterator(page) @@ -432,11 +334,11 @@ func NewOperationsClient(subscriptionID string) OperationsClient { func NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { return original.NewOperationsClientWithBaseURI(baseURI, subscriptionID) } -func NewPaymentMethodsByBillingProfileClient(subscriptionID string) PaymentMethodsByBillingProfileClient { - return original.NewPaymentMethodsByBillingProfileClient(subscriptionID) +func NewPaymentMethodsClient(subscriptionID string) PaymentMethodsClient { + return original.NewPaymentMethodsClient(subscriptionID) } -func NewPaymentMethodsByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) PaymentMethodsByBillingProfileClient { - return original.NewPaymentMethodsByBillingProfileClientWithBaseURI(baseURI, subscriptionID) +func NewPaymentMethodsClientWithBaseURI(baseURI string, subscriptionID string) PaymentMethodsClient { + return original.NewPaymentMethodsClientWithBaseURI(baseURI, subscriptionID) } func NewPaymentMethodsListResultIterator(page PaymentMethodsListResultPage) PaymentMethodsListResultIterator { return original.NewPaymentMethodsListResultIterator(page) @@ -444,29 +346,23 @@ func NewPaymentMethodsListResultIterator(page PaymentMethodsListResultPage) Paym func NewPaymentMethodsListResultPage(getNextPage func(context.Context, PaymentMethodsListResult) (PaymentMethodsListResult, error)) PaymentMethodsListResultPage { return original.NewPaymentMethodsListResultPage(getNextPage) } -func NewPolicyClient(subscriptionID string) PolicyClient { - return original.NewPolicyClient(subscriptionID) -} -func NewPolicyClientWithBaseURI(baseURI string, subscriptionID string) PolicyClient { - return original.NewPolicyClientWithBaseURI(baseURI, subscriptionID) -} -func NewProductsByBillingAccountClient(subscriptionID string) ProductsByBillingAccountClient { - return original.NewProductsByBillingAccountClient(subscriptionID) +func NewPermissionsClient(subscriptionID string) PermissionsClient { + return original.NewPermissionsClient(subscriptionID) } -func NewProductsByBillingAccountClientWithBaseURI(baseURI string, subscriptionID string) ProductsByBillingAccountClient { - return original.NewProductsByBillingAccountClientWithBaseURI(baseURI, subscriptionID) +func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { + return original.NewPermissionsClientWithBaseURI(baseURI, subscriptionID) } -func NewProductsByBillingSubscriptionsClient(subscriptionID string) ProductsByBillingSubscriptionsClient { - return original.NewProductsByBillingSubscriptionsClient(subscriptionID) +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return original.NewPoliciesClient(subscriptionID) } -func NewProductsByBillingSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductsByBillingSubscriptionsClient { - return original.NewProductsByBillingSubscriptionsClientWithBaseURI(baseURI, subscriptionID) +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return original.NewPoliciesClientWithBaseURI(baseURI, subscriptionID) } -func NewProductsByInvoiceSectionClient(subscriptionID string) ProductsByInvoiceSectionClient { - return original.NewProductsByInvoiceSectionClient(subscriptionID) +func NewPriceSheetClient(subscriptionID string) PriceSheetClient { + return original.NewPriceSheetClient(subscriptionID) } -func NewProductsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) ProductsByInvoiceSectionClient { - return original.NewProductsByInvoiceSectionClientWithBaseURI(baseURI, subscriptionID) +func NewPriceSheetClientWithBaseURI(baseURI string, subscriptionID string) PriceSheetClient { + return original.NewPriceSheetClientWithBaseURI(baseURI, subscriptionID) } func NewProductsClient(subscriptionID string) ProductsClient { return original.NewProductsClient(subscriptionID) @@ -480,30 +376,6 @@ func NewProductsListResultIterator(page ProductsListResultPage) ProductsListResu func NewProductsListResultPage(getNextPage func(context.Context, ProductsListResult) (ProductsListResult, error)) ProductsListResultPage { return original.NewProductsListResultPage(getNextPage) } -func NewProfileBillingPermissionsClient(subscriptionID string) ProfileBillingPermissionsClient { - return original.NewProfileBillingPermissionsClient(subscriptionID) -} -func NewProfileBillingPermissionsClientWithBaseURI(baseURI string, subscriptionID string) ProfileBillingPermissionsClient { - return original.NewProfileBillingPermissionsClientWithBaseURI(baseURI, subscriptionID) -} -func NewProfileBillingRoleAssignmentClient(subscriptionID string) ProfileBillingRoleAssignmentClient { - return original.NewProfileBillingRoleAssignmentClient(subscriptionID) -} -func NewProfileBillingRoleAssignmentClientWithBaseURI(baseURI string, subscriptionID string) ProfileBillingRoleAssignmentClient { - return original.NewProfileBillingRoleAssignmentClientWithBaseURI(baseURI, subscriptionID) -} -func NewProfileBillingRoleDefinitionClient(subscriptionID string) ProfileBillingRoleDefinitionClient { - return original.NewProfileBillingRoleDefinitionClient(subscriptionID) -} -func NewProfileBillingRoleDefinitionClientWithBaseURI(baseURI string, subscriptionID string) ProfileBillingRoleDefinitionClient { - return original.NewProfileBillingRoleDefinitionClientWithBaseURI(baseURI, subscriptionID) -} -func NewProfilesByBillingAccountNameClient(subscriptionID string) ProfilesByBillingAccountNameClient { - return original.NewProfilesByBillingAccountNameClient(subscriptionID) -} -func NewProfilesByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) ProfilesByBillingAccountNameClient { - return original.NewProfilesByBillingAccountNameClientWithBaseURI(baseURI, subscriptionID) -} func NewProfilesClient(subscriptionID string) ProfilesClient { return original.NewProfilesClient(subscriptionID) } @@ -528,23 +400,23 @@ func NewRecipientTransfersClient(subscriptionID string) RecipientTransfersClient func NewRecipientTransfersClientWithBaseURI(baseURI string, subscriptionID string) RecipientTransfersClient { return original.NewRecipientTransfersClientWithBaseURI(baseURI, subscriptionID) } -func NewSubscriptionClient(subscriptionID string) SubscriptionClient { - return original.NewSubscriptionClient(subscriptionID) +func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { + return original.NewRoleAssignmentsClient(subscriptionID) } -func NewSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionClient { - return original.NewSubscriptionClientWithBaseURI(baseURI, subscriptionID) +func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { + return original.NewRoleAssignmentsClientWithBaseURI(baseURI, subscriptionID) } -func NewSubscriptionsByBillingProfileClient(subscriptionID string) SubscriptionsByBillingProfileClient { - return original.NewSubscriptionsByBillingProfileClient(subscriptionID) +func NewRoleDefinitionsClient(subscriptionID string) RoleDefinitionsClient { + return original.NewRoleDefinitionsClient(subscriptionID) } -func NewSubscriptionsByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsByBillingProfileClient { - return original.NewSubscriptionsByBillingProfileClientWithBaseURI(baseURI, subscriptionID) +func NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) RoleDefinitionsClient { + return original.NewRoleDefinitionsClientWithBaseURI(baseURI, subscriptionID) } -func NewSubscriptionsByInvoiceSectionClient(subscriptionID string) SubscriptionsByInvoiceSectionClient { - return original.NewSubscriptionsByInvoiceSectionClient(subscriptionID) +func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { + return original.NewSubscriptionsClient(subscriptionID) } -func NewSubscriptionsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsByInvoiceSectionClient { - return original.NewSubscriptionsByInvoiceSectionClientWithBaseURI(baseURI, subscriptionID) +func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { + return original.NewSubscriptionsClientWithBaseURI(baseURI, subscriptionID) } func NewSubscriptionsListResultIterator(page SubscriptionsListResultPage) SubscriptionsListResultIterator { return original.NewSubscriptionsListResultIterator(page) @@ -552,23 +424,11 @@ func NewSubscriptionsListResultIterator(page SubscriptionsListResultPage) Subscr func NewSubscriptionsListResultPage(getNextPage func(context.Context, SubscriptionsListResult) (SubscriptionsListResult, error)) SubscriptionsListResultPage { return original.NewSubscriptionsListResultPage(getNextPage) } -func NewTransactionsByBillingAccountClient(subscriptionID string) TransactionsByBillingAccountClient { - return original.NewTransactionsByBillingAccountClient(subscriptionID) -} -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 NewTransactionsClient(subscriptionID string) TransactionsClient { + return original.NewTransactionsClient(subscriptionID) } -func NewTransactionsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByInvoiceSectionClient { - return original.NewTransactionsByInvoiceSectionClientWithBaseURI(baseURI, subscriptionID) +func NewTransactionsClientWithBaseURI(baseURI string, subscriptionID string) TransactionsClient { + return original.NewTransactionsClientWithBaseURI(baseURI, subscriptionID) } func NewTransactionsListResultIterator(page TransactionsListResultPage) TransactionsListResultIterator { return original.NewTransactionsListResultIterator(page) diff --git a/services/preview/billing/mgmt/2017-02-27-preview/billing/models.go b/services/preview/billing/mgmt/2017-02-27-preview/billing/models.go index b507280d2f6b..61d55a7d73bc 100644 --- a/services/preview/billing/mgmt/2017-02-27-preview/billing/models.go +++ b/services/preview/billing/mgmt/2017-02-27-preview/billing/models.go @@ -32,19 +32,19 @@ const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/20 // DownloadURL a secure URL that can be used to download a PDF invoice until the URL expires. type DownloadURL struct { - // ExpiryTime - The time in UTC at which this download URL will expire. + // ExpiryTime - READ-ONLY; The time in UTC at which this download URL will expire. ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // URL - The URL to the PDF file. + // URL - READ-ONLY; The URL to the PDF file. URL *string `json:"url,omitempty"` } // ErrorDetails the details of the error. type ErrorDetails struct { - // Code - Error code. + // Code - READ-ONLY; Error code. Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. + // Message - READ-ONLY; Error message indicating why the operation failed. Message *string `json:"message,omitempty"` - // Target - The target of the particular error. + // Target - READ-ONLY; The target of the particular error. Target *string `json:"target,omitempty"` } @@ -58,11 +58,11 @@ type ErrorResponse struct { type Invoice struct { autorest.Response `json:"-"` *InvoiceProperties `json:"properties,omitempty"` - // ID - Resource Id + // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` - // Name - Resource name + // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` - // Type - Resource type + // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` } @@ -72,15 +72,6 @@ func (i Invoice) MarshalJSON() ([]byte, error) { if i.InvoiceProperties != nil { objectMap["properties"] = i.InvoiceProperties } - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } return json.Marshal(objectMap) } @@ -137,9 +128,9 @@ func (i *Invoice) UnmarshalJSON(body []byte) error { // InvoiceProperties the properties of the invoice. type InvoiceProperties struct { - // InvoicePeriodStartDate - The start of the date range covered by the invoice. + // InvoicePeriodStartDate - READ-ONLY; The start of the date range covered by the invoice. InvoicePeriodStartDate *date.Date `json:"invoicePeriodStartDate,omitempty"` - // InvoicePeriodEndDate - The end of the date range covered by the invoice. + // InvoicePeriodEndDate - READ-ONLY; The end of the date range covered by the invoice. InvoicePeriodEndDate *date.Date `json:"invoicePeriodEndDate,omitempty"` // DownloadURL - A secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached. DownloadURL *DownloadURL `json:"downloadUrl,omitempty"` @@ -149,9 +140,9 @@ type InvoiceProperties struct { // reverse chronological order. type InvoicesListResult struct { autorest.Response `json:"-"` - // Value - The list of invoices. + // Value - READ-ONLY; The list of invoices. Value *[]Invoice `json:"value,omitempty"` - // NextLink - the link (url) to the next page of results. + // NextLink - READ-ONLY; the link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -294,7 +285,7 @@ func NewInvoicesListResultPage(getNextPage func(context.Context, InvoicesListRes // Operation a Billing REST API operation type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} + // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation} Name *string `json:"name,omitempty"` // Display - The object that represents the operation. Display *OperationDisplay `json:"display,omitempty"` @@ -302,11 +293,11 @@ type Operation struct { // OperationDisplay the object that represents the operation. type OperationDisplay struct { - // Provider - Service provider: Microsoft.Billing + // Provider - READ-ONLY; Service provider: Microsoft.Billing Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Invoice, etc. + // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. Operation *string `json:"operation,omitempty"` } @@ -314,9 +305,9 @@ type OperationDisplay struct { // and a URL link to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` - // Value - List of billing operations supported by the Microsoft.Billing resource provider. + // Value - READ-ONLY; List of billing operations supported by the Microsoft.Billing resource provider. Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. NextLink *string `json:"nextLink,omitempty"` } @@ -459,10 +450,10 @@ func NewOperationListResultPage(getNextPage func(context.Context, OperationListR // Resource the Resource model definition. type Resource struct { - // ID - Resource Id + // ID - READ-ONLY; Resource Id ID *string `json:"id,omitempty"` - // Name - Resource name + // Name - READ-ONLY; Resource name Name *string `json:"name,omitempty"` - // Type - Resource type + // Type - READ-ONLY; Resource type Type *string `json:"type,omitempty"` } diff --git a/services/preview/billing/mgmt/2017-04-24-preview/billing/models.go b/services/preview/billing/mgmt/2017-04-24-preview/billing/models.go index fab40189ee74..60303d1c0d97 100644 --- a/services/preview/billing/mgmt/2017-04-24-preview/billing/models.go +++ b/services/preview/billing/mgmt/2017-04-24-preview/billing/models.go @@ -32,19 +32,19 @@ const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/20 // DownloadURL a secure URL that can be used to download a PDF invoice until the URL expires. type DownloadURL struct { - // ExpiryTime - The time in UTC at which this download URL will expire. + // ExpiryTime - READ-ONLY; The time in UTC at which this download URL will expire. ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // URL - The URL to the PDF file. + // URL - READ-ONLY; The URL to the PDF file. URL *string `json:"url,omitempty"` } // ErrorDetails the details of the error. type ErrorDetails struct { - // Code - Error code. + // Code - READ-ONLY; Error code. Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. + // Message - READ-ONLY; Error message indicating why the operation failed. Message *string `json:"message,omitempty"` - // Target - The target of the particular error. + // Target - READ-ONLY; The target of the particular error. Target *string `json:"target,omitempty"` } @@ -59,11 +59,11 @@ type ErrorResponse struct { type Invoice struct { autorest.Response `json:"-"` *InvoiceProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -73,15 +73,6 @@ func (i Invoice) MarshalJSON() ([]byte, error) { if i.InvoiceProperties != nil { objectMap["properties"] = i.InvoiceProperties } - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } return json.Marshal(objectMap) } @@ -140,11 +131,11 @@ func (i *Invoice) UnmarshalJSON(body []byte) error { type InvoiceProperties struct { // DownloadURL - A secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached. DownloadURL *DownloadURL `json:"downloadUrl,omitempty"` - // InvoicePeriodStartDate - The start of the date range covered by the invoice. + // InvoicePeriodStartDate - READ-ONLY; The start of the date range covered by the invoice. InvoicePeriodStartDate *date.Date `json:"invoicePeriodStartDate,omitempty"` - // InvoicePeriodEndDate - The end of the date range covered by the invoice. + // InvoicePeriodEndDate - READ-ONLY; The end of the date range covered by the invoice. InvoicePeriodEndDate *date.Date `json:"invoicePeriodEndDate,omitempty"` - // BillingPeriodIds - Array of billing period ids that the invoice is attributed to. + // BillingPeriodIds - READ-ONLY; Array of billing period ids that the invoice is attributed to. BillingPeriodIds *[]string `json:"billingPeriodIds,omitempty"` } @@ -152,9 +143,9 @@ type InvoiceProperties struct { // chronological order. type InvoicesListResult struct { autorest.Response `json:"-"` - // Value - The list of invoices. + // Value - READ-ONLY; The list of invoices. Value *[]Invoice `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -297,7 +288,7 @@ func NewInvoicesListResultPage(getNextPage func(context.Context, InvoicesListRes // Operation a Billing REST API operation. type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation}. + // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. Name *string `json:"name,omitempty"` // Display - The object that represents the operation. Display *OperationDisplay `json:"display,omitempty"` @@ -305,11 +296,11 @@ type Operation struct { // OperationDisplay the object that represents the operation. type OperationDisplay struct { - // Provider - Service provider: Microsoft.Billing. + // Provider - READ-ONLY; Service provider: Microsoft.Billing. Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Invoice, etc. + // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. Operation *string `json:"operation,omitempty"` } @@ -317,9 +308,9 @@ type OperationDisplay struct { // to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` - // Value - List of billing operations supported by the Microsoft.Billing resource provider. + // Value - READ-ONLY; List of billing operations supported by the Microsoft.Billing resource provider. Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. NextLink *string `json:"nextLink,omitempty"` } @@ -464,11 +455,11 @@ func NewOperationListResultPage(getNextPage func(context.Context, OperationListR type Period struct { autorest.Response `json:"-"` *PeriodProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -478,15 +469,6 @@ func (p Period) MarshalJSON() ([]byte, error) { if p.PeriodProperties != nil { objectMap["properties"] = p.PeriodProperties } - if p.ID != nil { - objectMap["id"] = p.ID - } - if p.Name != nil { - objectMap["name"] = p.Name - } - if p.Type != nil { - objectMap["type"] = p.Type - } return json.Marshal(objectMap) } @@ -543,11 +525,11 @@ func (p *Period) UnmarshalJSON(body []byte) error { // PeriodProperties the properties of the billing period. type PeriodProperties struct { - // BillingPeriodStartDate - The start of the date range covered by the billing period. + // BillingPeriodStartDate - READ-ONLY; The start of the date range covered by the billing period. BillingPeriodStartDate *date.Date `json:"billingPeriodStartDate,omitempty"` - // BillingPeriodEndDate - The end of the date range covered by the billing period. + // BillingPeriodEndDate - READ-ONLY; The end of the date range covered by the billing period. BillingPeriodEndDate *date.Date `json:"billingPeriodEndDate,omitempty"` - // InvoiceIds - Array of invoice ids that associated with. + // InvoiceIds - READ-ONLY; Array of invoice ids that associated with. InvoiceIds *[]string `json:"invoiceIds,omitempty"` } @@ -555,9 +537,9 @@ type PeriodProperties struct { // reverse chronological order. type PeriodsListResult struct { autorest.Response `json:"-"` - // Value - The list of billing periods. + // Value - READ-ONLY; The list of billing periods. Value *[]Period `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -700,10 +682,10 @@ func NewPeriodsListResultPage(getNextPage func(context.Context, PeriodsListResul // Resource the Resource model definition. type Resource struct { - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } diff --git a/services/preview/billing/mgmt/2018-03-01-preview/billing/models.go b/services/preview/billing/mgmt/2018-03-01-preview/billing/models.go index 9a5b1b25f5df..eba51ebde7dc 100644 --- a/services/preview/billing/mgmt/2018-03-01-preview/billing/models.go +++ b/services/preview/billing/mgmt/2018-03-01-preview/billing/models.go @@ -32,9 +32,9 @@ const fqdn = "github.com/Azure/azure-sdk-for-go/services/preview/billing/mgmt/20 // DownloadURL a secure URL that can be used to download a PDF invoice until the URL expires. type DownloadURL struct { - // ExpiryTime - The time in UTC at which this download URL will expire. + // ExpiryTime - READ-ONLY; The time in UTC at which this download URL will expire. ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // URL - The URL to the PDF file. + // URL - READ-ONLY; The URL to the PDF file. URL *string `json:"url,omitempty"` } @@ -43,11 +43,11 @@ type EnrollmentAccount struct { autorest.Response `json:"-"` // EnrollmentAccountProperties - An enrollment account. *EnrollmentAccountProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -57,15 +57,6 @@ func (ea EnrollmentAccount) MarshalJSON() ([]byte, error) { if ea.EnrollmentAccountProperties != nil { objectMap["properties"] = ea.EnrollmentAccountProperties } - if ea.ID != nil { - objectMap["id"] = ea.ID - } - if ea.Name != nil { - objectMap["name"] = ea.Name - } - if ea.Type != nil { - objectMap["type"] = ea.Type - } return json.Marshal(objectMap) } @@ -123,9 +114,9 @@ func (ea *EnrollmentAccount) UnmarshalJSON(body []byte) error { // EnrollmentAccountListResult result of listing enrollment accounts. type EnrollmentAccountListResult struct { autorest.Response `json:"-"` - // Value - The list of enrollment accounts. + // Value - READ-ONLY; The list of enrollment accounts. Value *[]EnrollmentAccount `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -268,17 +259,17 @@ func NewEnrollmentAccountListResultPage(getNextPage func(context.Context, Enroll // EnrollmentAccountProperties the properties of the enrollment account. type EnrollmentAccountProperties struct { - // PrincipalName - The account owner's principal name. + // PrincipalName - READ-ONLY; The account owner's principal name. PrincipalName *string `json:"principalName,omitempty"` } // ErrorDetails the details of the error. type ErrorDetails struct { - // Code - Error code. + // Code - READ-ONLY; Error code. Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. + // Message - READ-ONLY; Error message indicating why the operation failed. Message *string `json:"message,omitempty"` - // Target - The target of the particular error. + // Target - READ-ONLY; The target of the particular error. Target *string `json:"target,omitempty"` } @@ -294,11 +285,11 @@ type Invoice struct { autorest.Response `json:"-"` // InvoiceProperties - An invoice. *InvoiceProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -308,15 +299,6 @@ func (i Invoice) MarshalJSON() ([]byte, error) { if i.InvoiceProperties != nil { objectMap["properties"] = i.InvoiceProperties } - if i.ID != nil { - objectMap["id"] = i.ID - } - if i.Name != nil { - objectMap["name"] = i.Name - } - if i.Type != nil { - objectMap["type"] = i.Type - } return json.Marshal(objectMap) } @@ -375,11 +357,11 @@ func (i *Invoice) UnmarshalJSON(body []byte) error { type InvoiceProperties struct { // DownloadURL - A secure link to download the PDF version of an invoice. The link will cease to work after its expiry time is reached. DownloadURL *DownloadURL `json:"downloadUrl,omitempty"` - // InvoicePeriodStartDate - The start of the date range covered by the invoice. + // InvoicePeriodStartDate - READ-ONLY; The start of the date range covered by the invoice. InvoicePeriodStartDate *date.Date `json:"invoicePeriodStartDate,omitempty"` - // InvoicePeriodEndDate - The end of the date range covered by the invoice. + // InvoicePeriodEndDate - READ-ONLY; The end of the date range covered by the invoice. InvoicePeriodEndDate *date.Date `json:"invoicePeriodEndDate,omitempty"` - // BillingPeriodIds - Array of billing period ids that the invoice is attributed to. + // BillingPeriodIds - READ-ONLY; Array of billing period ids that the invoice is attributed to. BillingPeriodIds *[]string `json:"billingPeriodIds,omitempty"` } @@ -387,9 +369,9 @@ type InvoiceProperties struct { // chronological order. type InvoicesListResult struct { autorest.Response `json:"-"` - // Value - The list of invoices. + // Value - READ-ONLY; The list of invoices. Value *[]Invoice `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -532,7 +514,7 @@ func NewInvoicesListResultPage(getNextPage func(context.Context, InvoicesListRes // Operation a Billing REST API operation. type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation}. + // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. Name *string `json:"name,omitempty"` // Display - The object that represents the operation. Display *OperationDisplay `json:"display,omitempty"` @@ -540,11 +522,11 @@ type Operation struct { // OperationDisplay the object that represents the operation. type OperationDisplay struct { - // Provider - Service provider: Microsoft.Billing. + // Provider - READ-ONLY; Service provider: Microsoft.Billing. Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Invoice, etc. + // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. Operation *string `json:"operation,omitempty"` } @@ -552,9 +534,9 @@ type OperationDisplay struct { // to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` - // Value - List of billing operations supported by the Microsoft.Billing resource provider. + // Value - READ-ONLY; List of billing operations supported by the Microsoft.Billing resource provider. Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. NextLink *string `json:"nextLink,omitempty"` } @@ -700,11 +682,11 @@ type Period struct { autorest.Response `json:"-"` // PeriodProperties - A billing period. *PeriodProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -714,15 +696,6 @@ func (p Period) MarshalJSON() ([]byte, error) { if p.PeriodProperties != nil { objectMap["properties"] = p.PeriodProperties } - if p.ID != nil { - objectMap["id"] = p.ID - } - if p.Name != nil { - objectMap["name"] = p.Name - } - if p.Type != nil { - objectMap["type"] = p.Type - } return json.Marshal(objectMap) } @@ -779,11 +752,11 @@ func (p *Period) UnmarshalJSON(body []byte) error { // PeriodProperties the properties of the billing period. type PeriodProperties struct { - // BillingPeriodStartDate - The start of the date range covered by the billing period. + // BillingPeriodStartDate - READ-ONLY; The start of the date range covered by the billing period. BillingPeriodStartDate *date.Date `json:"billingPeriodStartDate,omitempty"` - // BillingPeriodEndDate - The end of the date range covered by the billing period. + // BillingPeriodEndDate - READ-ONLY; The end of the date range covered by the billing period. BillingPeriodEndDate *date.Date `json:"billingPeriodEndDate,omitempty"` - // InvoiceIds - Array of invoice ids that associated with. + // InvoiceIds - READ-ONLY; Array of invoice ids that associated with. InvoiceIds *[]string `json:"invoiceIds,omitempty"` } @@ -791,9 +764,9 @@ type PeriodProperties struct { // reverse chronological order. type PeriodsListResult struct { autorest.Response `json:"-"` - // Value - The list of billing periods. + // Value - READ-ONLY; The list of billing periods. Value *[]Period `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -936,10 +909,10 @@ func NewPeriodsListResultPage(getNextPage func(context.Context, PeriodsListResul // Resource the Resource model definition. type Resource struct { - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingpermissions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingpermissions.go deleted file mode 100644 index aa36084c2101..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingpermissions.go +++ /dev/null @@ -1,115 +0,0 @@ -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" -) - -// AccountBillingPermissionsClient is the billing client provides access to billing resources for Azure subscriptions. -type AccountBillingPermissionsClient struct { - BaseClient -} - -// NewAccountBillingPermissionsClient creates an instance of the AccountBillingPermissionsClient client. -func NewAccountBillingPermissionsClient(subscriptionID string) AccountBillingPermissionsClient { - return NewAccountBillingPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountBillingPermissionsClientWithBaseURI creates an instance of the AccountBillingPermissionsClient client. -func NewAccountBillingPermissionsClientWithBaseURI(baseURI string, subscriptionID string) AccountBillingPermissionsClient { - return AccountBillingPermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all billingPermissions for the caller has for a billing account. -// Parameters: -// billingAccountName - billing Account Id. -func (client AccountBillingPermissionsClient) List(ctx context.Context, billingAccountName string) (result PermissionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingPermissionsClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingPermissionsClient", "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.AccountBillingPermissionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingPermissionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountBillingPermissionsClient) ListPreparer(ctx context.Context, billingAccountName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions", 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 AccountBillingPermissionsClient) 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 AccountBillingPermissionsClient) ListResponder(resp *http.Response) (result PermissionsListResult, 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/accountbillingroleassignment.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingroleassignment.go deleted file mode 100644 index e11d422ca37b..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingroleassignment.go +++ /dev/null @@ -1,346 +0,0 @@ -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" -) - -// AccountBillingRoleAssignmentClient is the billing client provides access to billing resources for Azure -// subscriptions. -type AccountBillingRoleAssignmentClient struct { - BaseClient -} - -// NewAccountBillingRoleAssignmentClient creates an instance of the AccountBillingRoleAssignmentClient client. -func NewAccountBillingRoleAssignmentClient(subscriptionID string) AccountBillingRoleAssignmentClient { - return NewAccountBillingRoleAssignmentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountBillingRoleAssignmentClientWithBaseURI creates an instance of the AccountBillingRoleAssignmentClient -// client. -func NewAccountBillingRoleAssignmentClientWithBaseURI(baseURI string, subscriptionID string) AccountBillingRoleAssignmentClient { - return AccountBillingRoleAssignmentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add the operation to add a role assignment to a billing account. -// Parameters: -// billingAccountName - billing Account Id. -// parameters - parameters supplied to add a role assignment. -func (client AccountBillingRoleAssignmentClient) Add(ctx context.Context, billingAccountName string, parameters RoleAssignmentPayload) (result RoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingRoleAssignmentClient.Add") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddPreparer(ctx, billingAccountName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Add", resp, "Failure responding to request") - } - - return -} - -// AddPreparer prepares the Add request. -func (client AccountBillingRoleAssignmentClient) AddPreparer(ctx context.Context, billingAccountName string, parameters RoleAssignmentPayload) (*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, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment", pathParameters), - autorest.WithJSON(parameters), - 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 AccountBillingRoleAssignmentClient) 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 AccountBillingRoleAssignmentClient) AddResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the role assignment on this billing account -// Parameters: -// billingAccountName - billing Account Id. -// billingRoleAssignmentName - role assignment id. -func (client AccountBillingRoleAssignmentClient) Delete(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingRoleAssignmentClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, billingAccountName, billingRoleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountBillingRoleAssignmentClient) DeletePreparer(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", 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 AccountBillingRoleAssignmentClient) 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 AccountBillingRoleAssignmentClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the role assignment for the caller -// Parameters: -// billingAccountName - billing Account Id. -// billingRoleAssignmentName - role assignment id. -func (client AccountBillingRoleAssignmentClient) Get(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingRoleAssignmentClient.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, billingRoleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "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.AccountBillingRoleAssignmentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountBillingRoleAssignmentClient) GetPreparer(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", 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 AccountBillingRoleAssignmentClient) 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 AccountBillingRoleAssignmentClient) GetResponder(resp *http.Response) (result RoleAssignment, 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 get the role assignments on the Billing Account -// Parameters: -// billingAccountName - billing Account Id. -func (client AccountBillingRoleAssignmentClient) List(ctx context.Context, billingAccountName string) (result RoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingRoleAssignmentClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "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.AccountBillingRoleAssignmentClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleAssignmentClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountBillingRoleAssignmentClient) ListPreparer(ctx context.Context, billingAccountName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments", 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 AccountBillingRoleAssignmentClient) 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 AccountBillingRoleAssignmentClient) ListResponder(resp *http.Response) (result RoleAssignmentListResult, 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/accountbillingroledefinition.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingroledefinition.go deleted file mode 100644 index 8f8d3bbd6aa6..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/accountbillingroledefinition.go +++ /dev/null @@ -1,193 +0,0 @@ -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" -) - -// AccountBillingRoleDefinitionClient is the billing client provides access to billing resources for Azure -// subscriptions. -type AccountBillingRoleDefinitionClient struct { - BaseClient -} - -// NewAccountBillingRoleDefinitionClient creates an instance of the AccountBillingRoleDefinitionClient client. -func NewAccountBillingRoleDefinitionClient(subscriptionID string) AccountBillingRoleDefinitionClient { - return NewAccountBillingRoleDefinitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountBillingRoleDefinitionClientWithBaseURI creates an instance of the AccountBillingRoleDefinitionClient -// client. -func NewAccountBillingRoleDefinitionClientWithBaseURI(baseURI string, subscriptionID string) AccountBillingRoleDefinitionClient { - return AccountBillingRoleDefinitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the role definition for a role -// Parameters: -// billingAccountName - billing Account Id. -// billingRoleDefinitionName - role definition id. -func (client AccountBillingRoleDefinitionClient) Get(ctx context.Context, billingAccountName string, billingRoleDefinitionName string) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingRoleDefinitionClient.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, billingRoleDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleDefinitionClient", "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.AccountBillingRoleDefinitionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleDefinitionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountBillingRoleDefinitionClient) GetPreparer(ctx context.Context, billingAccountName string, billingRoleDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingRoleDefinitionName": autorest.Encode("path", billingRoleDefinitionName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}", 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 AccountBillingRoleDefinitionClient) 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 AccountBillingRoleDefinitionClient) GetResponder(resp *http.Response) (result RoleDefinition, 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 lists the role definition for a billing account -// Parameters: -// billingAccountName - billing Account Id. -func (client AccountBillingRoleDefinitionClient) List(ctx context.Context, billingAccountName string) (result RoleDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBillingRoleDefinitionClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleDefinitionClient", "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.AccountBillingRoleDefinitionClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.AccountBillingRoleDefinitionClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountBillingRoleDefinitionClient) ListPreparer(ctx context.Context, billingAccountName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions", 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 AccountBillingRoleDefinitionClient) 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 AccountBillingRoleDefinitionClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, 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/availablebalancebybillingprofile.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/availablebalances.go similarity index 56% rename from services/preview/billing/mgmt/2018-11-01-preview/billing/availablebalancebybillingprofile.go rename to services/preview/billing/mgmt/2018-11-01-preview/billing/availablebalances.go index b31b3c665215..a251d2792063 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/availablebalancebybillingprofile.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/availablebalances.go @@ -25,30 +25,28 @@ import ( "net/http" ) -// AvailableBalanceByBillingProfileClient is the billing client provides access to billing resources for Azure -// subscriptions. -type AvailableBalanceByBillingProfileClient struct { +// AvailableBalancesClient is the billing client provides access to billing resources for Azure subscriptions. +type AvailableBalancesClient struct { BaseClient } -// NewAvailableBalanceByBillingProfileClient creates an instance of the AvailableBalanceByBillingProfileClient client. -func NewAvailableBalanceByBillingProfileClient(subscriptionID string) AvailableBalanceByBillingProfileClient { - return NewAvailableBalanceByBillingProfileClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewAvailableBalancesClient creates an instance of the AvailableBalancesClient client. +func NewAvailableBalancesClient(subscriptionID string) AvailableBalancesClient { + return NewAvailableBalancesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewAvailableBalanceByBillingProfileClientWithBaseURI creates an instance of the -// AvailableBalanceByBillingProfileClient client. -func NewAvailableBalanceByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) AvailableBalanceByBillingProfileClient { - return AvailableBalanceByBillingProfileClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewAvailableBalancesClientWithBaseURI creates an instance of the AvailableBalancesClient client. +func NewAvailableBalancesClientWithBaseURI(baseURI string, subscriptionID string) AvailableBalancesClient { + return AvailableBalancesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Get the latest available credit balance for a given billingAccountName and billingProfileName. +// GetByBillingProfile the latest available credit balance for a given billingAccountName and billingProfileName. // Parameters: // billingAccountName - billing Account Id. // billingProfileName - billing Profile Id. -func (client AvailableBalanceByBillingProfileClient) Get(ctx context.Context, billingAccountName string, billingProfileName string) (result AvailableBalance, err error) { +func (client AvailableBalancesClient) GetByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result AvailableBalance, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AvailableBalanceByBillingProfileClient.Get") + ctx = tracing.StartSpan(ctx, fqdn+"/AvailableBalancesClient.GetByBillingProfile") defer func() { sc := -1 if result.Response.Response != nil { @@ -57,29 +55,29 @@ func (client AvailableBalanceByBillingProfileClient) Get(ctx context.Context, bi tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetPreparer(ctx, billingAccountName, billingProfileName) + req, err := client.GetByBillingProfilePreparer(ctx, billingAccountName, billingProfileName) if err != nil { - err = autorest.NewErrorWithError(err, "billing.AvailableBalanceByBillingProfileClient", "Get", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "billing.AvailableBalancesClient", "GetByBillingProfile", nil, "Failure preparing request") return } - resp, err := client.GetSender(req) + resp, err := client.GetByBillingProfileSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.AvailableBalanceByBillingProfileClient", "Get", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "billing.AvailableBalancesClient", "GetByBillingProfile", resp, "Failure sending request") return } - result, err = client.GetResponder(resp) + result, err = client.GetByBillingProfileResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "billing.AvailableBalanceByBillingProfileClient", "Get", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "billing.AvailableBalancesClient", "GetByBillingProfile", resp, "Failure responding to request") } return } -// GetPreparer prepares the Get request. -func (client AvailableBalanceByBillingProfileClient) GetPreparer(ctx context.Context, billingAccountName string, billingProfileName string) (*http.Request, error) { +// GetByBillingProfilePreparer prepares the GetByBillingProfile request. +func (client AvailableBalancesClient) GetByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "billingAccountName": autorest.Encode("path", billingAccountName), "billingProfileName": autorest.Encode("path", billingProfileName), @@ -98,16 +96,16 @@ func (client AvailableBalanceByBillingProfileClient) GetPreparer(ctx context.Con return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetSender sends the Get request. The method will close the +// GetByBillingProfileSender sends the GetByBillingProfile request. The method will close the // http.Response Body if it receives an error. -func (client AvailableBalanceByBillingProfileClient) GetSender(req *http.Request) (*http.Response, error) { +func (client AvailableBalancesClient) GetByBillingProfileSender(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 +// GetByBillingProfileResponder handles the response to the GetByBillingProfile request. The method always // closes the http.Response Body. -func (client AvailableBalanceByBillingProfileClient) GetResponder(resp *http.Response) (result AvailableBalance, err error) { +func (client AvailableBalancesClient) GetByBillingProfileResponder(resp *http.Response) (result AvailableBalance, err error) { err = autorest.Respond( resp, client.ByInspecting(), 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 e663c2c3a61f..db380f4da2ac 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 @@ -23,14 +23,6 @@ import ( "github.com/Azure/go-autorest/autorest" ) -// BaseClientAPI contains the set of methods on the BaseClient type. -type BaseClientAPI interface { - 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) -} - -var _ BaseClientAPI = (*billing.BaseClient)(nil) - // AccountsClientAPI contains the set of methods on the AccountsClient type. type AccountsClientAPI interface { Get(ctx context.Context, billingAccountName string, expand string) (result billing.Account, err error) @@ -39,195 +31,113 @@ type AccountsClientAPI interface { var _ AccountsClientAPI = (*billing.AccountsClient)(nil) -// AvailableBalanceByBillingProfileClientAPI contains the set of methods on the AvailableBalanceByBillingProfileClient type. -type AvailableBalanceByBillingProfileClientAPI interface { - Get(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.AvailableBalance, err error) -} - -var _ AvailableBalanceByBillingProfileClientAPI = (*billing.AvailableBalanceByBillingProfileClient)(nil) - -// PaymentMethodsByBillingProfileClientAPI contains the set of methods on the PaymentMethodsByBillingProfileClient type. -type PaymentMethodsByBillingProfileClientAPI interface { - List(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.PaymentMethodsListResultPage, err error) +// AvailableBalancesClientAPI contains the set of methods on the AvailableBalancesClient type. +type AvailableBalancesClientAPI interface { + GetByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.AvailableBalance, err error) } -var _ PaymentMethodsByBillingProfileClientAPI = (*billing.PaymentMethodsByBillingProfileClient)(nil) +var _ AvailableBalancesClientAPI = (*billing.AvailableBalancesClient)(nil) -// ProfilesByBillingAccountNameClientAPI contains the set of methods on the ProfilesByBillingAccountNameClient type. -type ProfilesByBillingAccountNameClientAPI interface { - List(ctx context.Context, billingAccountName string, expand string) (result billing.ProfileListResult, err error) +// PaymentMethodsClientAPI contains the set of methods on the PaymentMethodsClient type. +type PaymentMethodsClientAPI interface { + ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.PaymentMethodsListResultPage, err error) } -var _ ProfilesByBillingAccountNameClientAPI = (*billing.ProfilesByBillingAccountNameClient)(nil) +var _ PaymentMethodsClientAPI = (*billing.PaymentMethodsClient)(nil) // ProfilesClientAPI contains the set of methods on the ProfilesClient type. type ProfilesClientAPI interface { Get(ctx context.Context, billingAccountName string, billingProfileName string, expand string) (result billing.Profile, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result billing.ProfileListResult, err error) Update(ctx context.Context, billingAccountName string, billingProfileName string, parameters billing.Profile) (result billing.ProfilesUpdateFuture, err error) } var _ ProfilesClientAPI = (*billing.ProfilesClient)(nil) -// InvoiceSectionsByBillingAccountNameClientAPI contains the set of methods on the InvoiceSectionsByBillingAccountNameClient type. -type InvoiceSectionsByBillingAccountNameClientAPI interface { - List(ctx context.Context, billingAccountName string, expand string) (result billing.InvoiceSectionListResult, err error) -} - -var _ InvoiceSectionsByBillingAccountNameClientAPI = (*billing.InvoiceSectionsByBillingAccountNameClient)(nil) - // InvoiceSectionsClientAPI contains the set of methods on the InvoiceSectionsClient type. type InvoiceSectionsClientAPI interface { Create(ctx context.Context, billingAccountName string, parameters billing.InvoiceSectionProperties) (result billing.InvoiceSectionsCreateFuture, err error) ElevateToBillingProfile(ctx context.Context, billingAccountName string, invoiceSectionName string) (result autorest.Response, err error) Get(ctx context.Context, billingAccountName string, invoiceSectionName string, expand string) (result billing.InvoiceSection, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result billing.InvoiceSectionListResult, err error) ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.InvoiceSectionListResult, err error) + ListByCreateSubscriptionPermission(ctx context.Context, billingAccountName string, expand string) (result billing.InvoiceSectionListResult, err error) Update(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters billing.InvoiceSection) (result billing.InvoiceSectionsUpdateFuture, err error) } var _ InvoiceSectionsClientAPI = (*billing.InvoiceSectionsClient)(nil) -// InvoiceSectionsWithCreateSubscriptionPermissionClientAPI contains the set of methods on the InvoiceSectionsWithCreateSubscriptionPermissionClient type. -type InvoiceSectionsWithCreateSubscriptionPermissionClientAPI interface { - List(ctx context.Context, billingAccountName string, expand string) (result billing.InvoiceSectionListResult, err error) -} - -var _ InvoiceSectionsWithCreateSubscriptionPermissionClientAPI = (*billing.InvoiceSectionsWithCreateSubscriptionPermissionClient)(nil) - -// DepartmentsByBillingAccountNameClientAPI contains the set of methods on the DepartmentsByBillingAccountNameClient type. -type DepartmentsByBillingAccountNameClientAPI interface { - List(ctx context.Context, billingAccountName string, expand string, filter string) (result billing.DepartmentListResult, err error) -} - -var _ DepartmentsByBillingAccountNameClientAPI = (*billing.DepartmentsByBillingAccountNameClient)(nil) - // DepartmentsClientAPI contains the set of methods on the DepartmentsClient type. type DepartmentsClientAPI interface { Get(ctx context.Context, billingAccountName string, departmentName string, expand string, filter string) (result billing.Department, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string, filter string) (result billing.DepartmentListResult, err error) } var _ DepartmentsClientAPI = (*billing.DepartmentsClient)(nil) -// EnrollmentAccountsByBillingAccountNameClientAPI contains the set of methods on the EnrollmentAccountsByBillingAccountNameClient type. -type EnrollmentAccountsByBillingAccountNameClientAPI interface { - List(ctx context.Context, billingAccountName string, expand string, filter string) (result billing.EnrollmentAccountListResult, err error) -} - -var _ EnrollmentAccountsByBillingAccountNameClientAPI = (*billing.EnrollmentAccountsByBillingAccountNameClient)(nil) - // EnrollmentAccountsClientAPI contains the set of methods on the EnrollmentAccountsClient type. type EnrollmentAccountsClientAPI interface { - GetByEnrollmentAccountAccountID(ctx context.Context, billingAccountName string, enrollmentAccountName string, expand string, filter string) (result billing.EnrollmentAccount, err error) + GetByEnrollmentAccountID(ctx context.Context, billingAccountName string, enrollmentAccountName string, expand string, filter string) (result billing.EnrollmentAccount, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string, filter string) (result billing.EnrollmentAccountListResult, err error) } var _ EnrollmentAccountsClientAPI = (*billing.EnrollmentAccountsClient)(nil) -// InvoicesByBillingAccountClientAPI contains the set of methods on the InvoicesByBillingAccountClient type. -type InvoicesByBillingAccountClientAPI interface { - List(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (result billing.InvoiceListResult, err error) -} - -var _ InvoicesByBillingAccountClientAPI = (*billing.InvoicesByBillingAccountClient)(nil) - -// InvoicePricesheetClientAPI contains the set of methods on the InvoicePricesheetClient type. -type InvoicePricesheetClientAPI interface { - Download(ctx context.Context, billingAccountName string, invoiceName string) (result billing.InvoicePricesheetDownloadFuture, err error) -} - -var _ InvoicePricesheetClientAPI = (*billing.InvoicePricesheetClient)(nil) - -// InvoicesByBillingProfileClientAPI contains the set of methods on the InvoicesByBillingProfileClient type. -type InvoicesByBillingProfileClientAPI interface { - List(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (result billing.InvoiceListResult, err error) -} - -var _ InvoicesByBillingProfileClientAPI = (*billing.InvoicesByBillingProfileClient)(nil) - -// InvoiceClientAPI contains the set of methods on the InvoiceClient type. -type InvoiceClientAPI interface { +// InvoicesClientAPI contains the set of methods on the InvoicesClient type. +type InvoicesClientAPI interface { Get(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string) (result billing.InvoiceSummary, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (result billing.InvoiceListResult, err error) + ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (result billing.InvoiceListResult, err error) } -var _ InvoiceClientAPI = (*billing.InvoiceClient)(nil) - -// ProductsByBillingSubscriptionsClientAPI contains the set of methods on the ProductsByBillingSubscriptionsClient type. -type ProductsByBillingSubscriptionsClientAPI interface { - List(ctx context.Context, billingAccountName string) (result billing.SubscriptionsListResultPage, err error) -} - -var _ ProductsByBillingSubscriptionsClientAPI = (*billing.ProductsByBillingSubscriptionsClient)(nil) +var _ InvoicesClientAPI = (*billing.InvoicesClient)(nil) -// SubscriptionsByBillingProfileClientAPI contains the set of methods on the SubscriptionsByBillingProfileClient type. -type SubscriptionsByBillingProfileClientAPI interface { - List(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.SubscriptionsListResult, err error) +// PriceSheetClientAPI contains the set of methods on the PriceSheetClient type. +type PriceSheetClientAPI interface { + Download(ctx context.Context, billingAccountName string, invoiceName string) (result billing.PriceSheetDownloadFuture, err error) } -var _ SubscriptionsByBillingProfileClientAPI = (*billing.SubscriptionsByBillingProfileClient)(nil) - -// SubscriptionsByInvoiceSectionClientAPI contains the set of methods on the SubscriptionsByInvoiceSectionClient type. -type SubscriptionsByInvoiceSectionClientAPI interface { - List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.SubscriptionsListResult, err error) -} +var _ PriceSheetClientAPI = (*billing.PriceSheetClient)(nil) -var _ SubscriptionsByInvoiceSectionClientAPI = (*billing.SubscriptionsByInvoiceSectionClient)(nil) - -// SubscriptionClientAPI contains the set of methods on the SubscriptionClient type. -type SubscriptionClientAPI interface { +// SubscriptionsClientAPI contains the set of methods on the SubscriptionsClient type. +type SubscriptionsClientAPI interface { Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string) (result billing.SubscriptionSummary, err error) - Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters billing.TransferBillingSubscriptionRequestProperties) (result billing.SubscriptionTransferFuture, err error) -} - -var _ SubscriptionClientAPI = (*billing.SubscriptionClient)(nil) - -// ProductsByBillingAccountClientAPI contains the set of methods on the ProductsByBillingAccountClient type. -type ProductsByBillingAccountClientAPI interface { - List(ctx context.Context, billingAccountName string, filter string) (result billing.ProductsListResultPage, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string) (result billing.SubscriptionsListResultPage, err error) + ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.SubscriptionsListResult, err error) + ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.SubscriptionsListResult, err error) + Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters billing.TransferBillingSubscriptionRequestProperties) (result billing.SubscriptionsTransferFuture, err error) } -var _ ProductsByBillingAccountClientAPI = (*billing.ProductsByBillingAccountClient)(nil) - -// ProductsByInvoiceSectionClientAPI contains the set of methods on the ProductsByInvoiceSectionClient type. -type ProductsByInvoiceSectionClientAPI interface { - List(ctx context.Context, billingAccountName string, invoiceSectionName string, filter string) (result billing.ProductsListResult, err error) -} - -var _ ProductsByInvoiceSectionClientAPI = (*billing.ProductsByInvoiceSectionClient)(nil) +var _ SubscriptionsClientAPI = (*billing.SubscriptionsClient)(nil) // ProductsClientAPI contains the set of methods on the ProductsClient type. type ProductsClientAPI interface { Get(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string) (result billing.ProductSummary, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string, filter string) (result billing.ProductsListResultPage, err error) + ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, filter string) (result billing.ProductsListResult, err error) Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, parameters billing.TransferProductRequestProperties) (result billing.ProductSummary, err error) + UpdateAutoRenewByBillingAccountName(ctx context.Context, billingAccountName string, productName string, body billing.UpdateAutoRenewRequest) (result billing.UpdateAutoRenewOperationSummary, err error) + UpdateAutoRenewByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body billing.UpdateAutoRenewRequest) (result billing.UpdateAutoRenewOperationSummary, err error) } var _ ProductsClientAPI = (*billing.ProductsClient)(nil) -// TransactionsByBillingAccountClientAPI contains the set of methods on the TransactionsByBillingAccountClient type. -type TransactionsByBillingAccountClientAPI interface { - List(ctx context.Context, billingAccountName string, startDate string, endDate string, filter string) (result billing.TransactionsListResultPage, err error) -} - -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) +// TransactionsClientAPI contains the set of methods on the TransactionsClient type. +type TransactionsClientAPI interface { + ListByBillingAccountName(ctx context.Context, billingAccountName string, startDate string, endDate string, filter string) (result billing.TransactionsListResultPage, err error) + ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, startDate string, endDate string, filter string) (result billing.TransactionsListResult, err error) + ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, startDate string, endDate string, filter string) (result billing.TransactionsListResult, err error) } -var _ TransactionsByInvoiceSectionClientAPI = (*billing.TransactionsByInvoiceSectionClient)(nil) +var _ TransactionsClientAPI = (*billing.TransactionsClient)(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) +// PoliciesClientAPI contains the set of methods on the PoliciesClient type. +type PoliciesClientAPI interface { + GetByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.Policy, err error) Update(ctx context.Context, billingAccountName string, billingProfileName string, parameters billing.Policy) (result billing.Policy, err error) } -var _ PolicyClientAPI = (*billing.PolicyClient)(nil) +var _ PoliciesClientAPI = (*billing.PoliciesClient)(nil) // PropertyClientAPI contains the set of methods on the PropertyClient type. type PropertyClientAPI interface { @@ -263,80 +173,44 @@ type OperationsClientAPI interface { var _ OperationsClientAPI = (*billing.OperationsClient)(nil) -// AccountBillingPermissionsClientAPI contains the set of methods on the AccountBillingPermissionsClient type. -type AccountBillingPermissionsClientAPI interface { - List(ctx context.Context, billingAccountName string) (result billing.PermissionsListResult, err error) -} - -var _ AccountBillingPermissionsClientAPI = (*billing.AccountBillingPermissionsClient)(nil) - -// InvoiceSectionsBillingPermissionsClientAPI contains the set of methods on the InvoiceSectionsBillingPermissionsClient type. -type InvoiceSectionsBillingPermissionsClientAPI interface { - List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.PermissionsListResult, err error) -} - -var _ InvoiceSectionsBillingPermissionsClientAPI = (*billing.InvoiceSectionsBillingPermissionsClient)(nil) - -// ProfileBillingPermissionsClientAPI contains the set of methods on the ProfileBillingPermissionsClient type. -type ProfileBillingPermissionsClientAPI interface { - List(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.PermissionsListResult, err error) -} - -var _ ProfileBillingPermissionsClientAPI = (*billing.ProfileBillingPermissionsClient)(nil) - -// AccountBillingRoleDefinitionClientAPI contains the set of methods on the AccountBillingRoleDefinitionClient type. -type AccountBillingRoleDefinitionClientAPI interface { - Get(ctx context.Context, billingAccountName string, billingRoleDefinitionName string) (result billing.RoleDefinition, err error) - List(ctx context.Context, billingAccountName string) (result billing.RoleDefinitionListResult, err error) -} - -var _ AccountBillingRoleDefinitionClientAPI = (*billing.AccountBillingRoleDefinitionClient)(nil) - -// InvoiceSectionBillingRoleDefinitionClientAPI contains the set of methods on the InvoiceSectionBillingRoleDefinitionClient type. -type InvoiceSectionBillingRoleDefinitionClientAPI interface { - Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleDefinitionName string) (result billing.RoleDefinition, err error) - List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.RoleDefinitionListResult, err error) -} - -var _ InvoiceSectionBillingRoleDefinitionClientAPI = (*billing.InvoiceSectionBillingRoleDefinitionClient)(nil) - -// ProfileBillingRoleDefinitionClientAPI contains the set of methods on the ProfileBillingRoleDefinitionClient type. -type ProfileBillingRoleDefinitionClientAPI interface { - Get(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleDefinitionName string) (result billing.RoleDefinition, err error) - List(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.RoleDefinitionListResult, err error) -} - -var _ ProfileBillingRoleDefinitionClientAPI = (*billing.ProfileBillingRoleDefinitionClient)(nil) - -// AccountBillingRoleAssignmentClientAPI contains the set of methods on the AccountBillingRoleAssignmentClient type. -type AccountBillingRoleAssignmentClientAPI interface { - Add(ctx context.Context, billingAccountName string, parameters billing.RoleAssignmentPayload) (result billing.RoleAssignmentListResult, err error) - Delete(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) - Get(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) - List(ctx context.Context, billingAccountName string) (result billing.RoleAssignmentListResult, err error) +// PermissionsClientAPI contains the set of methods on the PermissionsClient type. +type PermissionsClientAPI interface { + ListByBillingAccount(ctx context.Context, billingAccountName string) (result billing.PermissionsListResult, err error) + ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.PermissionsListResult, err error) + ListByInvoiceSections(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.PermissionsListResult, err error) } -var _ AccountBillingRoleAssignmentClientAPI = (*billing.AccountBillingRoleAssignmentClient)(nil) +var _ PermissionsClientAPI = (*billing.PermissionsClient)(nil) -// InvoiceSectionBillingRoleAssignmentClientAPI contains the set of methods on the InvoiceSectionBillingRoleAssignmentClient type. -type InvoiceSectionBillingRoleAssignmentClientAPI interface { - Add(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters billing.RoleAssignmentPayload) (result billing.RoleAssignmentListResult, err error) - Delete(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) - Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) - List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.RoleAssignmentListResult, err error) +// RoleDefinitionsClientAPI contains the set of methods on the RoleDefinitionsClient type. +type RoleDefinitionsClientAPI interface { + GetByBillingAccountName(ctx context.Context, billingAccountName string, billingRoleDefinitionName string) (result billing.RoleDefinition, err error) + GetByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleDefinitionName string) (result billing.RoleDefinition, err error) + GetByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleDefinitionName string) (result billing.RoleDefinition, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string) (result billing.RoleDefinitionListResult, err error) + ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.RoleDefinitionListResult, err error) + ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.RoleDefinitionListResult, err error) } -var _ InvoiceSectionBillingRoleAssignmentClientAPI = (*billing.InvoiceSectionBillingRoleAssignmentClient)(nil) +var _ RoleDefinitionsClientAPI = (*billing.RoleDefinitionsClient)(nil) -// ProfileBillingRoleAssignmentClientAPI contains the set of methods on the ProfileBillingRoleAssignmentClient type. -type ProfileBillingRoleAssignmentClientAPI interface { - Add(ctx context.Context, billingAccountName string, billingProfileName string, parameters billing.RoleAssignmentPayload) (result billing.RoleAssignmentListResult, err error) - Delete(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) - Get(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) - List(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.RoleAssignmentListResult, err error) +// RoleAssignmentsClientAPI contains the set of methods on the RoleAssignmentsClient type. +type RoleAssignmentsClientAPI interface { + AddByBillingAccountName(ctx context.Context, billingAccountName string, parameters billing.RoleAssignmentPayload) (result billing.RoleAssignmentListResult, err error) + AddByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, parameters billing.RoleAssignmentPayload) (result billing.RoleAssignmentListResult, err error) + AddByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters billing.RoleAssignmentPayload) (result billing.RoleAssignmentListResult, err error) + DeleteByBillingAccountName(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) + DeleteByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) + DeleteByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) + GetByBillingAccount(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) + GetByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) + GetByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result billing.RoleAssignment, err error) + ListByBillingAccountName(ctx context.Context, billingAccountName string) (result billing.RoleAssignmentListResult, err error) + ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result billing.RoleAssignmentListResult, err error) + ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result billing.RoleAssignmentListResult, err error) } -var _ ProfileBillingRoleAssignmentClientAPI = (*billing.ProfileBillingRoleAssignmentClient)(nil) +var _ RoleAssignmentsClientAPI = (*billing.RoleAssignmentsClient)(nil) // AgreementsClientAPI contains the set of methods on the AgreementsClient type. type AgreementsClientAPI interface { 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 89ab7df44a44..3c6cc9a7fdd3 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 @@ -21,11 +21,7 @@ package billing // 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" ) const ( @@ -53,163 +49,3 @@ func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient { SubscriptionID: subscriptionID, } } - -// UpdateAutoRenewForBillingAccount cancel product by product id -// Parameters: -// billingAccountName - billing Account Id. -// productName - invoice Id. -// body - update auto renew request parameters. -func (client BaseClient) UpdateAutoRenewForBillingAccount(ctx context.Context, billingAccountName string, productName string, body UpdateAutoRenewRequest) (result UpdateAutoRenewOperationSummary, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateAutoRenewForBillingAccount") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateAutoRenewForBillingAccountPreparer(ctx, billingAccountName, productName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.BaseClient", "UpdateAutoRenewForBillingAccount", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAutoRenewForBillingAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.BaseClient", "UpdateAutoRenewForBillingAccount", resp, "Failure sending request") - return - } - - result, err = client.UpdateAutoRenewForBillingAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.BaseClient", "UpdateAutoRenewForBillingAccount", resp, "Failure responding to request") - } - - return -} - -// UpdateAutoRenewForBillingAccountPreparer prepares the UpdateAutoRenewForBillingAccount request. -func (client BaseClient) UpdateAutoRenewForBillingAccountPreparer(ctx context.Context, billingAccountName string, productName string, body UpdateAutoRenewRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "productName": autorest.Encode("path", productName), - } - - const APIVersion = "2018-11-01-preview" - 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.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateAutoRenewForBillingAccountSender sends the UpdateAutoRenewForBillingAccount request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) UpdateAutoRenewForBillingAccountSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateAutoRenewForBillingAccountResponder handles the response to the UpdateAutoRenewForBillingAccount request. The method always -// closes the http.Response Body. -func (client BaseClient) UpdateAutoRenewForBillingAccountResponder(resp *http.Response) (result UpdateAutoRenewOperationSummary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// UpdateAutoRenewForInvoiceSection cancel auto renew for product by product id -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// productName - invoice Id. -// body - update auto renew request parameters. -func (client BaseClient) UpdateAutoRenewForInvoiceSection(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body UpdateAutoRenewRequest) (result UpdateAutoRenewOperationSummary, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BaseClient.UpdateAutoRenewForInvoiceSection") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.UpdateAutoRenewForInvoiceSectionPreparer(ctx, billingAccountName, invoiceSectionName, productName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.BaseClient", "UpdateAutoRenewForInvoiceSection", nil, "Failure preparing request") - return - } - - resp, err := client.UpdateAutoRenewForInvoiceSectionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.BaseClient", "UpdateAutoRenewForInvoiceSection", resp, "Failure sending request") - return - } - - result, err = client.UpdateAutoRenewForInvoiceSectionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.BaseClient", "UpdateAutoRenewForInvoiceSection", resp, "Failure responding to request") - } - - return -} - -// UpdateAutoRenewForInvoiceSectionPreparer prepares the UpdateAutoRenewForInvoiceSection request. -func (client BaseClient) UpdateAutoRenewForInvoiceSectionPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body UpdateAutoRenewRequest) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "invoiceSectionName": autorest.Encode("path", invoiceSectionName), - "productName": autorest.Encode("path", productName), - } - - const APIVersion = "2018-11-01-preview" - 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.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateAutoRenewForInvoiceSectionSender sends the UpdateAutoRenewForInvoiceSection request. The method will close the -// http.Response Body if it receives an error. -func (client BaseClient) UpdateAutoRenewForInvoiceSectionSender(req *http.Request) (*http.Response, error) { - return autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// UpdateAutoRenewForInvoiceSectionResponder handles the response to the UpdateAutoRenewForInvoiceSection request. The method always -// closes the http.Response Body. -func (client BaseClient) UpdateAutoRenewForInvoiceSectionResponder(resp *http.Response) (result UpdateAutoRenewOperationSummary, 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/departments.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/departments.go index 056ca42c5013..34c369870561 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/departments.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/departments.go @@ -124,3 +124,86 @@ func (client DepartmentsClient) GetResponder(resp *http.Response) (result Depart result.Response = autorest.Response{Response: resp} return } + +// ListByBillingAccountName lists all departments for a user which he has access to. +// Parameters: +// billingAccountName - billing Account Id. +// expand - may be used to expand the enrollmentAccounts. +// filter - 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 DepartmentsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string, filter string) (result DepartmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/DepartmentsClient.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, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.DepartmentsClient", "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.DepartmentsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.DepartmentsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client DepartmentsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, expand string, filter 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) + } + 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}/departments", 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 DepartmentsClient) 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 DepartmentsClient) ListByBillingAccountNameResponder(resp *http.Response) (result DepartmentListResult, 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/departmentsbybillingaccountname.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/departmentsbybillingaccountname.go deleted file mode 100644 index 31cd0581094d..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/departmentsbybillingaccountname.go +++ /dev/null @@ -1,126 +0,0 @@ -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" -) - -// DepartmentsByBillingAccountNameClient is the billing client provides access to billing resources for Azure -// subscriptions. -type DepartmentsByBillingAccountNameClient struct { - BaseClient -} - -// NewDepartmentsByBillingAccountNameClient creates an instance of the DepartmentsByBillingAccountNameClient client. -func NewDepartmentsByBillingAccountNameClient(subscriptionID string) DepartmentsByBillingAccountNameClient { - return NewDepartmentsByBillingAccountNameClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewDepartmentsByBillingAccountNameClientWithBaseURI creates an instance of the DepartmentsByBillingAccountNameClient -// client. -func NewDepartmentsByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) DepartmentsByBillingAccountNameClient { - return DepartmentsByBillingAccountNameClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all departments for a user which he has access to. -// Parameters: -// billingAccountName - billing Account Id. -// expand - may be used to expand the enrollmentAccounts. -// filter - 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 DepartmentsByBillingAccountNameClient) List(ctx context.Context, billingAccountName string, expand string, filter string) (result DepartmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/DepartmentsByBillingAccountNameClient.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, expand, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.DepartmentsByBillingAccountNameClient", "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.DepartmentsByBillingAccountNameClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.DepartmentsByBillingAccountNameClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client DepartmentsByBillingAccountNameClient) ListPreparer(ctx context.Context, billingAccountName string, expand string, filter 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) - } - 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}/departments", 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 DepartmentsByBillingAccountNameClient) 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 DepartmentsByBillingAccountNameClient) ListResponder(resp *http.Response) (result DepartmentListResult, 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/enrollmentaccounts.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/enrollmentaccounts.go index e1ad9f8e3ea6..07b0a01c639e 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/enrollmentaccounts.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/enrollmentaccounts.go @@ -40,16 +40,16 @@ func NewEnrollmentAccountsClientWithBaseURI(baseURI string, subscriptionID strin return EnrollmentAccountsClient{NewWithBaseURI(baseURI, subscriptionID)} } -// GetByEnrollmentAccountAccountID get the enrollment account by id. +// GetByEnrollmentAccountID get the enrollment account by id. // Parameters: // billingAccountName - billing Account Id. // enrollmentAccountName - enrollment Account Id. // expand - may be used to expand the Department. // filter - 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 EnrollmentAccountsClient) GetByEnrollmentAccountAccountID(ctx context.Context, billingAccountName string, enrollmentAccountName string, expand string, filter string) (result EnrollmentAccount, err error) { +func (client EnrollmentAccountsClient) GetByEnrollmentAccountID(ctx context.Context, billingAccountName string, enrollmentAccountName string, expand string, filter string) (result EnrollmentAccount, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnrollmentAccountsClient.GetByEnrollmentAccountAccountID") + ctx = tracing.StartSpan(ctx, fqdn+"/EnrollmentAccountsClient.GetByEnrollmentAccountID") defer func() { sc := -1 if result.Response.Response != nil { @@ -58,29 +58,29 @@ func (client EnrollmentAccountsClient) GetByEnrollmentAccountAccountID(ctx conte tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetByEnrollmentAccountAccountIDPreparer(ctx, billingAccountName, enrollmentAccountName, expand, filter) + req, err := client.GetByEnrollmentAccountIDPreparer(ctx, billingAccountName, enrollmentAccountName, expand, filter) if err != nil { - err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "GetByEnrollmentAccountAccountID", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "GetByEnrollmentAccountID", nil, "Failure preparing request") return } - resp, err := client.GetByEnrollmentAccountAccountIDSender(req) + resp, err := client.GetByEnrollmentAccountIDSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "GetByEnrollmentAccountAccountID", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "GetByEnrollmentAccountID", resp, "Failure sending request") return } - result, err = client.GetByEnrollmentAccountAccountIDResponder(resp) + result, err = client.GetByEnrollmentAccountIDResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "GetByEnrollmentAccountAccountID", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "GetByEnrollmentAccountID", resp, "Failure responding to request") } return } -// GetByEnrollmentAccountAccountIDPreparer prepares the GetByEnrollmentAccountAccountID request. -func (client EnrollmentAccountsClient) GetByEnrollmentAccountAccountIDPreparer(ctx context.Context, billingAccountName string, enrollmentAccountName string, expand string, filter string) (*http.Request, error) { +// GetByEnrollmentAccountIDPreparer prepares the GetByEnrollmentAccountID request. +func (client EnrollmentAccountsClient) GetByEnrollmentAccountIDPreparer(ctx context.Context, billingAccountName string, enrollmentAccountName string, expand string, filter string) (*http.Request, error) { pathParameters := map[string]interface{}{ "billingAccountName": autorest.Encode("path", billingAccountName), "enrollmentAccountName": autorest.Encode("path", enrollmentAccountName), @@ -105,16 +105,99 @@ func (client EnrollmentAccountsClient) GetByEnrollmentAccountAccountIDPreparer(c return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetByEnrollmentAccountAccountIDSender sends the GetByEnrollmentAccountAccountID request. The method will close the +// GetByEnrollmentAccountIDSender sends the GetByEnrollmentAccountID request. The method will close the // http.Response Body if it receives an error. -func (client EnrollmentAccountsClient) GetByEnrollmentAccountAccountIDSender(req *http.Request) (*http.Response, error) { +func (client EnrollmentAccountsClient) GetByEnrollmentAccountIDSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// GetByEnrollmentAccountAccountIDResponder handles the response to the GetByEnrollmentAccountAccountID request. The method always +// GetByEnrollmentAccountIDResponder handles the response to the GetByEnrollmentAccountID request. The method always // closes the http.Response Body. -func (client EnrollmentAccountsClient) GetByEnrollmentAccountAccountIDResponder(resp *http.Response) (result EnrollmentAccount, err error) { +func (client EnrollmentAccountsClient) GetByEnrollmentAccountIDResponder(resp *http.Response) (result EnrollmentAccount, 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 Enrollment Accounts for a user which he has access to. +// Parameters: +// billingAccountName - billing Account Id. +// expand - may be used to expand the department. +// filter - 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 EnrollmentAccountsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string, filter string) (result EnrollmentAccountListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/EnrollmentAccountsClient.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, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "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.EnrollmentAccountsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client EnrollmentAccountsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, expand string, filter 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) + } + 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}/enrollmentAccounts", 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 EnrollmentAccountsClient) 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 EnrollmentAccountsClient) ListByBillingAccountNameResponder(resp *http.Response) (result EnrollmentAccountListResult, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/enrollmentaccountsbybillingaccountname.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/enrollmentaccountsbybillingaccountname.go deleted file mode 100644 index cd5669383686..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/enrollmentaccountsbybillingaccountname.go +++ /dev/null @@ -1,127 +0,0 @@ -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" -) - -// EnrollmentAccountsByBillingAccountNameClient is the billing client provides access to billing resources for Azure -// subscriptions. -type EnrollmentAccountsByBillingAccountNameClient struct { - BaseClient -} - -// NewEnrollmentAccountsByBillingAccountNameClient creates an instance of the -// EnrollmentAccountsByBillingAccountNameClient client. -func NewEnrollmentAccountsByBillingAccountNameClient(subscriptionID string) EnrollmentAccountsByBillingAccountNameClient { - return NewEnrollmentAccountsByBillingAccountNameClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewEnrollmentAccountsByBillingAccountNameClientWithBaseURI creates an instance of the -// EnrollmentAccountsByBillingAccountNameClient client. -func NewEnrollmentAccountsByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) EnrollmentAccountsByBillingAccountNameClient { - return EnrollmentAccountsByBillingAccountNameClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all Enrollment Accounts for a user which he has access to. -// Parameters: -// billingAccountName - billing Account Id. -// expand - may be used to expand the department. -// filter - 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 EnrollmentAccountsByBillingAccountNameClient) List(ctx context.Context, billingAccountName string, expand string, filter string) (result EnrollmentAccountListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/EnrollmentAccountsByBillingAccountNameClient.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, expand, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsByBillingAccountNameClient", "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.EnrollmentAccountsByBillingAccountNameClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.EnrollmentAccountsByBillingAccountNameClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client EnrollmentAccountsByBillingAccountNameClient) ListPreparer(ctx context.Context, billingAccountName string, expand string, filter 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) - } - 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}/enrollmentAccounts", 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 EnrollmentAccountsByBillingAccountNameClient) 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 EnrollmentAccountsByBillingAccountNameClient) ListResponder(resp *http.Response) (result EnrollmentAccountListResult, 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/invoice.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoice.go deleted file mode 100644 index 8be120575cfb..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoice.go +++ /dev/null @@ -1,119 +0,0 @@ -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" -) - -// InvoiceClient is the billing client provides access to billing resources for Azure subscriptions. -type InvoiceClient struct { - BaseClient -} - -// NewInvoiceClient creates an instance of the InvoiceClient client. -func NewInvoiceClient(subscriptionID string) InvoiceClient { - return NewInvoiceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoiceClientWithBaseURI creates an instance of the InvoiceClient client. -func NewInvoiceClientWithBaseURI(baseURI string, subscriptionID string) InvoiceClient { - return InvoiceClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the invoice by id. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// invoiceName - invoice Id. -func (client InvoiceClient) Get(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string) (result InvoiceSummary, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceClient.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, billingProfileName, invoiceName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceClient", "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.InvoiceClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client InvoiceClient) GetPreparer(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingProfileName": autorest.Encode("path", billingProfileName), - "invoiceName": autorest.Encode("path", invoiceName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}", 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 InvoiceClient) 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 InvoiceClient) GetResponder(resp *http.Response) (result InvoiceSummary, 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/invoices.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoices.go new file mode 100644 index 000000000000..81b84c470ce1 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoices.go @@ -0,0 +1,277 @@ +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" +) + +// InvoicesClient is the billing client provides access to billing resources for Azure subscriptions. +type InvoicesClient struct { + BaseClient +} + +// NewInvoicesClient creates an instance of the InvoicesClient client. +func NewInvoicesClient(subscriptionID string) InvoicesClient { + return NewInvoicesClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewInvoicesClientWithBaseURI creates an instance of the InvoicesClient client. +func NewInvoicesClientWithBaseURI(baseURI string, subscriptionID string) InvoicesClient { + return InvoicesClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get the invoice by name. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// invoiceName - invoice Id. +func (client InvoicesClient) Get(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string) (result InvoiceSummary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoicesClient.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, billingProfileName, invoiceName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "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.InvoicesClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client InvoicesClient) GetPreparer(ctx context.Context, billingAccountName string, billingProfileName string, invoiceName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingProfileName": autorest.Encode("path", billingProfileName), + "invoiceName": autorest.Encode("path", invoiceName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices/{invoiceName}", 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 InvoicesClient) 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 InvoicesClient) GetResponder(resp *http.Response) (result InvoiceSummary, 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 list of invoices for a billing account. +// Parameters: +// billingAccountName - billing Account Id. +// periodStartDate - invoice period start date. +// periodEndDate - invoice period end date. +func (client InvoicesClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (result InvoiceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoicesClient.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, periodStartDate, periodEndDate) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "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.InvoicesClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client InvoicesClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate 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, + "periodEndDate": autorest.Encode("query", periodEndDate), + "periodStartDate": autorest.Encode("query", periodStartDate), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices", 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 InvoicesClient) 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 InvoicesClient) ListByBillingAccountNameResponder(resp *http.Response) (result InvoiceListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBillingProfile list of invoices for a billing profile. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// periodStartDate - invoice period start date. +// periodEndDate - invoice period end date. +func (client InvoicesClient) ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (result InvoiceListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoicesClient.ListByBillingProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfilePreparer(ctx, billingAccountName, billingProfileName, periodStartDate, periodEndDate) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "ListByBillingProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "ListByBillingProfile", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoicesClient", "ListByBillingProfile", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfilePreparer prepares the ListByBillingProfile request. +func (client InvoicesClient) ListByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate 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, + "periodEndDate": autorest.Encode("query", periodEndDate), + "periodStartDate": autorest.Encode("query", periodStartDate), + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileSender sends the ListByBillingProfile request. The method will close the +// http.Response Body if it receives an error. +func (client InvoicesClient) ListByBillingProfileSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileResponder handles the response to the ListByBillingProfile request. The method always +// closes the http.Response Body. +func (client InvoicesClient) ListByBillingProfileResponder(resp *http.Response) (result InvoiceListResult, 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/invoicesbybillingaccount.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesbybillingaccount.go deleted file mode 100644 index 608fef064806..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesbybillingaccount.go +++ /dev/null @@ -1,119 +0,0 @@ -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" -) - -// InvoicesByBillingAccountClient is the billing client provides access to billing resources for Azure subscriptions. -type InvoicesByBillingAccountClient struct { - BaseClient -} - -// NewInvoicesByBillingAccountClient creates an instance of the InvoicesByBillingAccountClient client. -func NewInvoicesByBillingAccountClient(subscriptionID string) InvoicesByBillingAccountClient { - return NewInvoicesByBillingAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoicesByBillingAccountClientWithBaseURI creates an instance of the InvoicesByBillingAccountClient client. -func NewInvoicesByBillingAccountClientWithBaseURI(baseURI string, subscriptionID string) InvoicesByBillingAccountClient { - return InvoicesByBillingAccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of invoices for a billing account. -// Parameters: -// billingAccountName - billing Account Id. -// periodStartDate - invoice period start date. -// periodEndDate - invoice period end date. -func (client InvoicesByBillingAccountClient) List(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate string) (result InvoiceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoicesByBillingAccountClient.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, periodStartDate, periodEndDate) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesByBillingAccountClient", "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.InvoicesByBillingAccountClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesByBillingAccountClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoicesByBillingAccountClient) ListPreparer(ctx context.Context, billingAccountName string, periodStartDate string, periodEndDate 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, - "periodEndDate": autorest.Encode("query", periodEndDate), - "periodStartDate": autorest.Encode("query", periodStartDate), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoices", 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 InvoicesByBillingAccountClient) 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 InvoicesByBillingAccountClient) ListResponder(resp *http.Response) (result InvoiceListResult, 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/invoicesbybillingprofile.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesbybillingprofile.go deleted file mode 100644 index 92ef9e800a9f..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesbybillingprofile.go +++ /dev/null @@ -1,121 +0,0 @@ -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" -) - -// InvoicesByBillingProfileClient is the billing client provides access to billing resources for Azure subscriptions. -type InvoicesByBillingProfileClient struct { - BaseClient -} - -// NewInvoicesByBillingProfileClient creates an instance of the InvoicesByBillingProfileClient client. -func NewInvoicesByBillingProfileClient(subscriptionID string) InvoicesByBillingProfileClient { - return NewInvoicesByBillingProfileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoicesByBillingProfileClientWithBaseURI creates an instance of the InvoicesByBillingProfileClient client. -func NewInvoicesByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) InvoicesByBillingProfileClient { - return InvoicesByBillingProfileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list of invoices for a billing profile. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// periodStartDate - invoice period start date. -// periodEndDate - invoice period end date. -func (client InvoicesByBillingProfileClient) List(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate string) (result InvoiceListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoicesByBillingProfileClient.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, periodStartDate, periodEndDate) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesByBillingProfileClient", "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.InvoicesByBillingProfileClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicesByBillingProfileClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoicesByBillingProfileClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName string, periodStartDate string, periodEndDate 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, - "periodEndDate": autorest.Encode("query", periodEndDate), - "periodStartDate": autorest.Encode("query", periodStartDate), - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoices", 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 InvoicesByBillingProfileClient) 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 InvoicesByBillingProfileClient) ListResponder(resp *http.Response) (result InvoiceListResult, 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/invoicesectionbillingroleassignment.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionbillingroleassignment.go deleted file mode 100644 index ee1b3d457981..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionbillingroleassignment.go +++ /dev/null @@ -1,355 +0,0 @@ -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" -) - -// InvoiceSectionBillingRoleAssignmentClient is the billing client provides access to billing resources for Azure -// subscriptions. -type InvoiceSectionBillingRoleAssignmentClient struct { - BaseClient -} - -// NewInvoiceSectionBillingRoleAssignmentClient creates an instance of the InvoiceSectionBillingRoleAssignmentClient -// client. -func NewInvoiceSectionBillingRoleAssignmentClient(subscriptionID string) InvoiceSectionBillingRoleAssignmentClient { - return NewInvoiceSectionBillingRoleAssignmentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoiceSectionBillingRoleAssignmentClientWithBaseURI creates an instance of the -// InvoiceSectionBillingRoleAssignmentClient client. -func NewInvoiceSectionBillingRoleAssignmentClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionBillingRoleAssignmentClient { - return InvoiceSectionBillingRoleAssignmentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add the operation to add a role assignment to a invoice Section. -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// parameters - parameters supplied to add a role assignment. -func (client InvoiceSectionBillingRoleAssignmentClient) Add(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters RoleAssignmentPayload) (result RoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionBillingRoleAssignmentClient.Add") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddPreparer(ctx, billingAccountName, invoiceSectionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Add", resp, "Failure responding to request") - } - - return -} - -// AddPreparer prepares the Add request. -func (client InvoiceSectionBillingRoleAssignmentClient) AddPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters RoleAssignmentPayload) (*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, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment", pathParameters), - autorest.WithJSON(parameters), - 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 InvoiceSectionBillingRoleAssignmentClient) 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 InvoiceSectionBillingRoleAssignmentClient) AddResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the role assignment on this invoice Section -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// billingRoleAssignmentName - role assignment id. -func (client InvoiceSectionBillingRoleAssignmentClient) Delete(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionBillingRoleAssignmentClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, billingAccountName, invoiceSectionName, billingRoleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client InvoiceSectionBillingRoleAssignmentClient) DeletePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), - "invoiceSectionName": autorest.Encode("path", invoiceSectionName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", 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 InvoiceSectionBillingRoleAssignmentClient) 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 InvoiceSectionBillingRoleAssignmentClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the role assignment for the caller on the invoice Section -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// billingRoleAssignmentName - role assignment id. -func (client InvoiceSectionBillingRoleAssignmentClient) Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionBillingRoleAssignmentClient.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, invoiceSectionName, billingRoleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "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.InvoiceSectionBillingRoleAssignmentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client InvoiceSectionBillingRoleAssignmentClient) GetPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), - "invoiceSectionName": autorest.Encode("path", invoiceSectionName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", 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 InvoiceSectionBillingRoleAssignmentClient) 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 InvoiceSectionBillingRoleAssignmentClient) GetResponder(resp *http.Response) (result RoleAssignment, 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 get the role assignments on the invoice Section -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -func (client InvoiceSectionBillingRoleAssignmentClient) List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result RoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionBillingRoleAssignmentClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "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.InvoiceSectionBillingRoleAssignmentClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleAssignmentClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoiceSectionBillingRoleAssignmentClient) ListPreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments", 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 InvoiceSectionBillingRoleAssignmentClient) 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 InvoiceSectionBillingRoleAssignmentClient) ListResponder(resp *http.Response) (result RoleAssignmentListResult, 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/invoicesectionbillingroledefinition.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionbillingroledefinition.go deleted file mode 100644 index 73b02df6ebef..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionbillingroledefinition.go +++ /dev/null @@ -1,198 +0,0 @@ -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" -) - -// InvoiceSectionBillingRoleDefinitionClient is the billing client provides access to billing resources for Azure -// subscriptions. -type InvoiceSectionBillingRoleDefinitionClient struct { - BaseClient -} - -// NewInvoiceSectionBillingRoleDefinitionClient creates an instance of the InvoiceSectionBillingRoleDefinitionClient -// client. -func NewInvoiceSectionBillingRoleDefinitionClient(subscriptionID string) InvoiceSectionBillingRoleDefinitionClient { - return NewInvoiceSectionBillingRoleDefinitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoiceSectionBillingRoleDefinitionClientWithBaseURI creates an instance of the -// InvoiceSectionBillingRoleDefinitionClient client. -func NewInvoiceSectionBillingRoleDefinitionClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionBillingRoleDefinitionClient { - return InvoiceSectionBillingRoleDefinitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the role definition for a role -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// billingRoleDefinitionName - role definition id. -func (client InvoiceSectionBillingRoleDefinitionClient) Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleDefinitionName string) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionBillingRoleDefinitionClient.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, invoiceSectionName, billingRoleDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleDefinitionClient", "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.InvoiceSectionBillingRoleDefinitionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleDefinitionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client InvoiceSectionBillingRoleDefinitionClient) GetPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingRoleDefinitionName": autorest.Encode("path", billingRoleDefinitionName), - "invoiceSectionName": autorest.Encode("path", invoiceSectionName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}", 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 InvoiceSectionBillingRoleDefinitionClient) 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 InvoiceSectionBillingRoleDefinitionClient) GetResponder(resp *http.Response) (result RoleDefinition, 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 lists the role definition for a invoice Section -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -func (client InvoiceSectionBillingRoleDefinitionClient) List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result RoleDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionBillingRoleDefinitionClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleDefinitionClient", "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.InvoiceSectionBillingRoleDefinitionClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionBillingRoleDefinitionClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoiceSectionBillingRoleDefinitionClient) ListPreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions", 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 InvoiceSectionBillingRoleDefinitionClient) 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 InvoiceSectionBillingRoleDefinitionClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, 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/invoicesections.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go index 0c9c42d47af6..8786a6a894cb 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesections.go @@ -266,6 +266,84 @@ func (client InvoiceSectionsClient) GetResponder(resp *http.Response) (result In return } +// ListByBillingAccountName lists all invoice sections for a user which he has access to. +// Parameters: +// billingAccountName - billing Account Id. +// expand - may be used to expand the billingProfiles. +func (client InvoiceSectionsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result InvoiceSectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsClient.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.InvoiceSectionsClient", "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.InvoiceSectionsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client InvoiceSectionsClient) 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}/invoiceSections", 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 InvoiceSectionsClient) 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 InvoiceSectionsClient) ListByBillingAccountNameResponder(resp *http.Response) (result InvoiceSectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // ListByBillingProfileName lists all invoice sections under a billing profile for a user which he has access to. // Parameters: // billingAccountName - billing Account Id. @@ -342,6 +420,84 @@ func (client InvoiceSectionsClient) ListByBillingProfileNameResponder(resp *http return } +// ListByCreateSubscriptionPermission lists all invoiceSections with create subscription permission for a user. +// Parameters: +// billingAccountName - billing Account Id. +// expand - may be used to expand the billingProfiles. +func (client InvoiceSectionsClient) ListByCreateSubscriptionPermission(ctx context.Context, billingAccountName string, expand string) (result InvoiceSectionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsClient.ListByCreateSubscriptionPermission") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByCreateSubscriptionPermissionPreparer(ctx, billingAccountName, expand) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByCreateSubscriptionPermission", nil, "Failure preparing request") + return + } + + resp, err := client.ListByCreateSubscriptionPermissionSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByCreateSubscriptionPermission", resp, "Failure sending request") + return + } + + result, err = client.ListByCreateSubscriptionPermissionResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsClient", "ListByCreateSubscriptionPermission", resp, "Failure responding to request") + } + + return +} + +// ListByCreateSubscriptionPermissionPreparer prepares the ListByCreateSubscriptionPermission request. +func (client InvoiceSectionsClient) ListByCreateSubscriptionPermissionPreparer(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}/listInvoiceSectionsWithCreateSubscriptionPermission", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByCreateSubscriptionPermissionSender sends the ListByCreateSubscriptionPermission request. The method will close the +// http.Response Body if it receives an error. +func (client InvoiceSectionsClient) ListByCreateSubscriptionPermissionSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByCreateSubscriptionPermissionResponder handles the response to the ListByCreateSubscriptionPermission request. The method always +// closes the http.Response Body. +func (client InvoiceSectionsClient) ListByCreateSubscriptionPermissionResponder(resp *http.Response) (result InvoiceSectionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update the operation to update a InvoiceSection. // Parameters: // billingAccountName - billing Account Id. diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbillingpermissions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbillingpermissions.go deleted file mode 100644 index 8751a7ddb29e..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbillingpermissions.go +++ /dev/null @@ -1,120 +0,0 @@ -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" -) - -// InvoiceSectionsBillingPermissionsClient is the billing client provides access to billing resources for Azure -// subscriptions. -type InvoiceSectionsBillingPermissionsClient struct { - BaseClient -} - -// NewInvoiceSectionsBillingPermissionsClient creates an instance of the InvoiceSectionsBillingPermissionsClient -// client. -func NewInvoiceSectionsBillingPermissionsClient(subscriptionID string) InvoiceSectionsBillingPermissionsClient { - return NewInvoiceSectionsBillingPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoiceSectionsBillingPermissionsClientWithBaseURI creates an instance of the -// InvoiceSectionsBillingPermissionsClient client. -func NewInvoiceSectionsBillingPermissionsClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsBillingPermissionsClient { - return InvoiceSectionsBillingPermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all billingPermissions for the caller has for a Invoice Section. -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -func (client InvoiceSectionsBillingPermissionsClient) List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result PermissionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsBillingPermissionsClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsBillingPermissionsClient", "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.InvoiceSectionsBillingPermissionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsBillingPermissionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoiceSectionsBillingPermissionsClient) ListPreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions", 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 InvoiceSectionsBillingPermissionsClient) 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 InvoiceSectionsBillingPermissionsClient) ListResponder(resp *http.Response) (result PermissionsListResult, 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/invoicesectionsbybillingaccountname.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbybillingaccountname.go deleted file mode 100644 index e2a46dd86e12..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionsbybillingaccountname.go +++ /dev/null @@ -1,122 +0,0 @@ -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" -) - -// InvoiceSectionsByBillingAccountNameClient is the billing client provides access to billing resources for Azure -// subscriptions. -type InvoiceSectionsByBillingAccountNameClient struct { - BaseClient -} - -// NewInvoiceSectionsByBillingAccountNameClient creates an instance of the InvoiceSectionsByBillingAccountNameClient -// client. -func NewInvoiceSectionsByBillingAccountNameClient(subscriptionID string) InvoiceSectionsByBillingAccountNameClient { - return NewInvoiceSectionsByBillingAccountNameClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoiceSectionsByBillingAccountNameClientWithBaseURI creates an instance of the -// InvoiceSectionsByBillingAccountNameClient client. -func NewInvoiceSectionsByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsByBillingAccountNameClient { - return InvoiceSectionsByBillingAccountNameClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all invoice sections for a user which he has access to. -// Parameters: -// billingAccountName - billing Account Id. -// expand - may be used to expand the billingProfiles. -func (client InvoiceSectionsByBillingAccountNameClient) List(ctx context.Context, billingAccountName string, expand string) (result InvoiceSectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsByBillingAccountNameClient.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, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsByBillingAccountNameClient", "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.InvoiceSectionsByBillingAccountNameClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsByBillingAccountNameClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoiceSectionsByBillingAccountNameClient) ListPreparer(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}/invoiceSections", 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 InvoiceSectionsByBillingAccountNameClient) 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 InvoiceSectionsByBillingAccountNameClient) ListResponder(resp *http.Response) (result InvoiceSectionListResult, 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/invoicesectionswithcreatesubscriptionpermission.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionswithcreatesubscriptionpermission.go deleted file mode 100644 index f94e2b820c55..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicesectionswithcreatesubscriptionpermission.go +++ /dev/null @@ -1,122 +0,0 @@ -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" -) - -// InvoiceSectionsWithCreateSubscriptionPermissionClient is the billing client provides access to billing resources for -// Azure subscriptions. -type InvoiceSectionsWithCreateSubscriptionPermissionClient struct { - BaseClient -} - -// NewInvoiceSectionsWithCreateSubscriptionPermissionClient creates an instance of the -// InvoiceSectionsWithCreateSubscriptionPermissionClient client. -func NewInvoiceSectionsWithCreateSubscriptionPermissionClient(subscriptionID string) InvoiceSectionsWithCreateSubscriptionPermissionClient { - return NewInvoiceSectionsWithCreateSubscriptionPermissionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewInvoiceSectionsWithCreateSubscriptionPermissionClientWithBaseURI creates an instance of the -// InvoiceSectionsWithCreateSubscriptionPermissionClient client. -func NewInvoiceSectionsWithCreateSubscriptionPermissionClientWithBaseURI(baseURI string, subscriptionID string) InvoiceSectionsWithCreateSubscriptionPermissionClient { - return InvoiceSectionsWithCreateSubscriptionPermissionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all invoiceSections with create subscription permission for a user. -// Parameters: -// billingAccountName - billing Account Id. -// expand - may be used to expand the billingProfiles. -func (client InvoiceSectionsWithCreateSubscriptionPermissionClient) List(ctx context.Context, billingAccountName string, expand string) (result InvoiceSectionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoiceSectionsWithCreateSubscriptionPermissionClient.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, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsWithCreateSubscriptionPermissionClient", "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.InvoiceSectionsWithCreateSubscriptionPermissionClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsWithCreateSubscriptionPermissionClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client InvoiceSectionsWithCreateSubscriptionPermissionClient) ListPreparer(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}/listInvoiceSectionsWithCreateSubscriptionPermission", 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 InvoiceSectionsWithCreateSubscriptionPermissionClient) 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 InvoiceSectionsWithCreateSubscriptionPermissionClient) ListResponder(resp *http.Response) (result InvoiceSectionListResult, 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/models.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/models.go index 302bd9b84f11..25d11d9c3472 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 @@ -336,11 +336,11 @@ type Account struct { autorest.Response `json:"-"` // AccountProperties - A billing account. *AccountProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -350,15 +350,6 @@ func (a Account) MarshalJSON() ([]byte, error) { if a.AccountProperties != nil { objectMap["properties"] = a.AccountProperties } - 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) } @@ -416,35 +407,35 @@ func (a *Account) UnmarshalJSON(body []byte) error { // AccountListResult result of listing billing accounts. type AccountListResult struct { autorest.Response `json:"-"` - // Value - The list of billing accounts. + // Value - READ-ONLY; The list of billing accounts. Value *[]Account `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } // AccountProperties the properties of the billing account. type AccountProperties struct { - // DisplayName - The billing account name. + // DisplayName - READ-ONLY; The billing account name. DisplayName *string `json:"displayName,omitempty"` - // AccountType - The billing account Type. Possible values include: 'AccountTypeOrganization', 'AccountTypeEnrollment' + // AccountType - READ-ONLY; The billing account Type. Possible values include: 'AccountTypeOrganization', 'AccountTypeEnrollment' AccountType AccountType `json:"accountType,omitempty"` // Address - The address associated with billing account. Address *Address `json:"address,omitempty"` - // Company - Company Name. + // Company - READ-ONLY; Company Name. Company *string `json:"company,omitempty"` - // Country - Country Name. + // Country - READ-ONLY; Country Name. Country *string `json:"country,omitempty"` // InvoiceSections - The invoice sections associated to the billing account. By default this is not populated, unless it's specified in $expand. InvoiceSections *[]InvoiceSection `json:"invoiceSections,omitempty"` // BillingProfiles - The billing profiles associated to the billing account. By default this is not populated, unless it's specified in $expand. BillingProfiles *[]Profile `json:"billingProfiles,omitempty"` - // EnrollmentDetails - The details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. + // EnrollmentDetails - READ-ONLY; The details about the associated legacy enrollment. By default this is not populated, unless it's specified in $expand. EnrollmentDetails *Enrollment `json:"enrollmentDetails,omitempty"` // Departments - The departments associated to the enrollment. Departments *[]Department `json:"departments,omitempty"` // EnrollmentAccounts - The accounts associated to the enrollment. EnrollmentAccounts *[]EnrollmentAccount `json:"enrollmentAccounts,omitempty"` - // HasReadAccess - Specifies whether the user has read access on billing account. + // HasReadAccess - READ-ONLY; Specifies whether the user has read access on billing account. HasReadAccess *bool `json:"hasReadAccess,omitempty"` } @@ -477,11 +468,11 @@ type Agreement struct { autorest.Response `json:"-"` // AgreementProperties - An agreement. *AgreementProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -491,15 +482,6 @@ func (a Agreement) MarshalJSON() ([]byte, error) { 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) } @@ -557,31 +539,31 @@ func (a *Agreement) UnmarshalJSON(body []byte) error { // AgreementListResult result of listing agreements. type AgreementListResult struct { autorest.Response `json:"-"` - // Value - The list of agreements. + // Value - READ-ONLY; The list of agreements. Value *[]Agreement `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; 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 - READ-ONLY; The link to the agreement. AgreementLink *string `json:"agreementLink,omitempty"` - // EffectiveDate - Effective date. + // EffectiveDate - READ-ONLY; Effective date. EffectiveDate *date.Time `json:"effectiveDate,omitempty"` - // ExpirationDate - Expiration date. + // ExpirationDate - READ-ONLY; 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 - READ-ONLY; The agreement status Status *string `json:"status,omitempty"` } // Amount the Amount. type Amount struct { - // Currency - The currency for the amount value. + // Currency - READ-ONLY; The currency for the amount value. Currency *string `json:"currency,omitempty"` - // Value - Amount value. + // Value - READ-ONLY; Amount value. Value *float64 `json:"value,omitempty"` } @@ -589,11 +571,11 @@ type Amount struct { type AvailableBalance struct { autorest.Response `json:"-"` *AvailableBalanceProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -603,15 +585,6 @@ func (ab AvailableBalance) MarshalJSON() ([]byte, error) { if ab.AvailableBalanceProperties != nil { objectMap["properties"] = ab.AvailableBalanceProperties } - if ab.ID != nil { - objectMap["id"] = ab.ID - } - if ab.Name != nil { - objectMap["name"] = ab.Name - } - if ab.Type != nil { - objectMap["type"] = ab.Type - } return json.Marshal(objectMap) } @@ -668,7 +641,7 @@ func (ab *AvailableBalance) UnmarshalJSON(body []byte) error { // AvailableBalanceProperties the properties of available balance. type AvailableBalanceProperties struct { - // Amount - Balance Amount. + // Amount - READ-ONLY; Balance Amount. Amount *Amount `json:"amount,omitempty"` } @@ -677,11 +650,11 @@ type Department struct { autorest.Response `json:"-"` // DepartmentProperties - A department. *DepartmentProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -691,15 +664,6 @@ func (d Department) MarshalJSON() ([]byte, error) { if d.DepartmentProperties != nil { objectMap["properties"] = d.DepartmentProperties } - if d.ID != nil { - objectMap["id"] = d.ID - } - if d.Name != nil { - objectMap["name"] = d.Name - } - if d.Type != nil { - objectMap["type"] = d.Type - } return json.Marshal(objectMap) } @@ -757,9 +721,9 @@ func (d *Department) UnmarshalJSON(body []byte) error { // DepartmentListResult result of listing departments. type DepartmentListResult struct { autorest.Response `json:"-"` - // Value - The list of departments. + // Value - READ-ONLY; The list of departments. Value *[]Department `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -777,11 +741,11 @@ type DepartmentProperties struct { // DetailedTransferStatus detailed transfer status. type DetailedTransferStatus struct { - // ProductType - Type of product being transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' + // ProductType - READ-ONLY; Type of product being transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' ProductType ProductType `json:"productType,omitempty"` - // ProductID - Id of product being transferred. + // ProductID - READ-ONLY; Id of product being transferred. ProductID *string `json:"productId,omitempty"` - // TransferStatus - Transfer status. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'Failed' + // TransferStatus - READ-ONLY; Transfer status. Possible values include: 'NotStarted', 'InProgress', 'Completed', 'Failed' TransferStatus ProductTransferStatus `json:"transferStatus,omitempty"` // ErrorDetails - Error details for transfer execution. ErrorDetails *Error `json:"errorDetails,omitempty"` @@ -789,26 +753,26 @@ type DetailedTransferStatus struct { // DownloadProperties the properties of the invoice download. type DownloadProperties struct { - // Kind - Document type. Possible values include: 'Invoice', 'VoidNote', 'Receipt', 'CreditNote' + // Kind - READ-ONLY; Document type. Possible values include: 'Invoice', 'VoidNote', 'Receipt', 'CreditNote' Kind Kind `json:"kind,omitempty"` - // URL - Document URL. + // URL - READ-ONLY; Document URL. URL *string `json:"url,omitempty"` } // DownloadURL a secure URL that can be used to download a an entity until the URL expires. type DownloadURL struct { autorest.Response `json:"-"` - // ExpiryTime - The time in UTC at which this download URL will expire. + // ExpiryTime - READ-ONLY; The time in UTC at which this download URL will expire. ExpiryTime *date.Time `json:"expiryTime,omitempty"` - // URL - The URL to the PDF file. + // URL - READ-ONLY; The URL to the PDF file. URL *string `json:"url,omitempty"` } // EnabledAzureSKUs details about the enabled azure sku. type EnabledAzureSKUs struct { - // SkuID - The sku id. + // SkuID - READ-ONLY; The sku id. SkuID *string `json:"skuId,omitempty"` - // SkuDescription - The sku description. + // SkuDescription - READ-ONLY; The sku description. SkuDescription *string `json:"skuDescription,omitempty"` } @@ -818,19 +782,19 @@ type Enrollment struct { StartDate *date.Time `json:"startDate,omitempty"` // EndDate - Enrollment End Date EndDate *date.Time `json:"endDate,omitempty"` - // Currency - The currency associated with enrollment + // Currency - READ-ONLY; The currency associated with enrollment Currency *string `json:"currency,omitempty"` - // Channel - The channel for Enrollment + // Channel - READ-ONLY; The channel for Enrollment Channel *string `json:"channel,omitempty"` - // Policies - The attributes associated with legacy enrollment. + // Policies - READ-ONLY; The attributes associated with legacy enrollment. Policies *EnrollmentPolicies `json:"policies,omitempty"` - // Language - The language for Enrollment + // Language - READ-ONLY; The language for Enrollment Language *string `json:"language,omitempty"` - // CountryCode - The countryCode for Enrollment + // CountryCode - READ-ONLY; The countryCode for Enrollment CountryCode *string `json:"countryCode,omitempty"` - // Status - Enrollment status + // Status - READ-ONLY; Enrollment status Status *string `json:"status,omitempty"` - // BillingCycle - Enrollment billing cycle + // BillingCycle - READ-ONLY; Enrollment billing cycle BillingCycle *string `json:"billingCycle,omitempty"` } @@ -839,11 +803,11 @@ type EnrollmentAccount struct { autorest.Response `json:"-"` // EnrollmentAccountProperties - An account. *EnrollmentAccountProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -853,15 +817,6 @@ func (ea EnrollmentAccount) MarshalJSON() ([]byte, error) { if ea.EnrollmentAccountProperties != nil { objectMap["properties"] = ea.EnrollmentAccountProperties } - if ea.ID != nil { - objectMap["id"] = ea.ID - } - if ea.Name != nil { - objectMap["name"] = ea.Name - } - if ea.Type != nil { - objectMap["type"] = ea.Type - } return json.Marshal(objectMap) } @@ -931,9 +886,9 @@ type EnrollmentAccountContext struct { // EnrollmentAccountListResult result of listing enrollment accounts. type EnrollmentAccountListResult struct { autorest.Response `json:"-"` - // Value - The list of enrollment accounts. + // Value - READ-ONLY; The list of enrollment accounts. Value *[]EnrollmentAccount `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -957,31 +912,31 @@ type EnrollmentAccountProperties struct { // EnrollmentPolicies the attributes associated with legacy enrollment type EnrollmentPolicies struct { - // AccountOwnerViewCharges - The accountOwnerViewCharges flag for Enrollment + // AccountOwnerViewCharges - READ-ONLY; The accountOwnerViewCharges flag for Enrollment AccountOwnerViewCharges *bool `json:"accountOwnerViewCharges,omitempty"` - // DepartmentAdminViewCharges - The departmentAdminViewCharges flag for Enrollment + // DepartmentAdminViewCharges - READ-ONLY; The departmentAdminViewCharges flag for Enrollment DepartmentAdminViewCharges *bool `json:"departmentAdminViewCharges,omitempty"` - // MarketplacesEnabled - The marketplaces flag for Enrollment + // MarketplacesEnabled - READ-ONLY; The marketplaces flag for Enrollment MarketplacesEnabled *bool `json:"marketplacesEnabled,omitempty"` - // ReservedInstancesEnabled - The reserved instances flag for Enrollment + // ReservedInstancesEnabled - READ-ONLY; The reserved instances flag for Enrollment ReservedInstancesEnabled *bool `json:"reservedInstancesEnabled,omitempty"` } // Error error details for transfer execution. type Error struct { - // ErrorCode - Error code. + // ErrorCode - READ-ONLY; Error code. ErrorCode *string `json:"errorCode,omitempty"` - // ErrorMessage - Error message. + // ErrorMessage - READ-ONLY; Error message. ErrorMessage *string `json:"errorMessage,omitempty"` } // ErrorDetails the details of the error. type ErrorDetails struct { - // Code - Error code. + // Code - READ-ONLY; Error code. Code *string `json:"code,omitempty"` - // Message - Error message indicating why the operation failed. + // Message - READ-ONLY; Error message indicating why the operation failed. Message *string `json:"message,omitempty"` - // Target - The target of the particular error. + // Target - READ-ONLY; The target of the particular error. Target *string `json:"target,omitempty"` } @@ -1042,51 +997,22 @@ func (itr *InitiateTransferRequest) UnmarshalJSON(body []byte) error { // InvoiceListResult result of listing invoices. type InvoiceListResult struct { autorest.Response `json:"-"` - // Value - The list of invoices. + // Value - READ-ONLY; The list of invoices. Value *[]InvoiceSummary `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } -// InvoicePricesheetDownloadFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type InvoicePricesheetDownloadFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *InvoicePricesheetDownloadFuture) Result(client InvoicePricesheetClient) (du DownloadURL, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicePricesheetDownloadFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("billing.InvoicePricesheetDownloadFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if du.Response.Response, err = future.GetResult(sender); err == nil && du.Response.Response.StatusCode != http.StatusNoContent { - du, err = client.DownloadResponder(du.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicePricesheetDownloadFuture", "Result", du.Response.Response, "Failure responding to request") - } - } - return -} - // InvoiceSection an InvoiceSection resource. type InvoiceSection struct { autorest.Response `json:"-"` // InvoiceSectionProperties - The InvoiceSection. *InvoiceSectionProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -1096,15 +1022,6 @@ func (is InvoiceSection) MarshalJSON() ([]byte, error) { if is.InvoiceSectionProperties != nil { objectMap["properties"] = is.InvoiceSectionProperties } - if is.ID != nil { - objectMap["id"] = is.ID - } - if is.Name != nil { - objectMap["name"] = is.Name - } - if is.Type != nil { - objectMap["type"] = is.Type - } return json.Marshal(objectMap) } @@ -1162,9 +1079,9 @@ func (is *InvoiceSection) UnmarshalJSON(body []byte) error { // InvoiceSectionListResult result of listing invoice sections. type InvoiceSectionListResult struct { autorest.Response `json:"-"` - // Value - The list of invoice sections. + // Value - READ-ONLY; The list of invoice sections. Value *[]InvoiceSection `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -1186,7 +1103,7 @@ type InvoiceSectionsCreateFuture struct { // If the operation has not completed it will return an error. func (future *InvoiceSectionsCreateFuture) Result(client InvoiceSectionsClient) (is InvoiceSection, err error) { var done bool - done, err = future.Done(client) + done, err = future.DoneWithContext(context.Background(), client) if err != nil { err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsCreateFuture", "Result", future.Response(), "Polling failure") return @@ -1215,7 +1132,7 @@ type InvoiceSectionsUpdateFuture struct { // If the operation has not completed it will return an error. func (future *InvoiceSectionsUpdateFuture) Result(client InvoiceSectionsClient) (is InvoiceSection, err error) { var done bool - done, err = future.Done(client) + done, err = future.DoneWithContext(context.Background(), client) if err != nil { err = autorest.NewErrorWithError(err, "billing.InvoiceSectionsUpdateFuture", "Result", future.Response(), "Polling failure") return @@ -1239,11 +1156,11 @@ type InvoiceSummary struct { autorest.Response `json:"-"` // InvoiceSummaryProperties - An invoice. *InvoiceSummaryProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -1253,15 +1170,6 @@ func (is InvoiceSummary) MarshalJSON() ([]byte, error) { if is.InvoiceSummaryProperties != nil { objectMap["properties"] = is.InvoiceSummaryProperties } - if is.ID != nil { - objectMap["id"] = is.ID - } - if is.Name != nil { - objectMap["name"] = is.Name - } - if is.Type != nil { - objectMap["type"] = is.Type - } return json.Marshal(objectMap) } @@ -1318,35 +1226,35 @@ func (is *InvoiceSummary) UnmarshalJSON(body []byte) error { // InvoiceSummaryProperties the properties of the invoice. type InvoiceSummaryProperties struct { - // DueDate - The due date for invoice. + // DueDate - READ-ONLY; The due date for invoice. DueDate *date.Time `json:"dueDate,omitempty"` - // InvoiceDate - The date when invoice was created. + // InvoiceDate - READ-ONLY; The date when invoice was created. InvoiceDate *date.Time `json:"invoiceDate,omitempty"` - // Status - Invoice status. Possible values include: 'StatusPastDue', 'StatusDue', 'StatusPaid', 'StatusVoid' + // Status - READ-ONLY; Invoice status. Possible values include: 'StatusPastDue', 'StatusDue', 'StatusPaid', 'StatusVoid' Status Status `json:"status,omitempty"` - // AmountDue - Amount due. + // AmountDue - READ-ONLY; Amount due. AmountDue *Amount `json:"amountDue,omitempty"` - // BilledAmount - Amount billed. + // BilledAmount - READ-ONLY; Amount billed. BilledAmount *Amount `json:"billedAmount,omitempty"` - // InvoicePeriodStartDate - The start date of the billing period. + // InvoicePeriodStartDate - READ-ONLY; The start date of the billing period. InvoicePeriodStartDate *date.Time `json:"invoicePeriodStartDate,omitempty"` - // InvoicePeriodEndDate - The end date of the billing period. + // InvoicePeriodEndDate - READ-ONLY; The end date of the billing period. InvoicePeriodEndDate *date.Time `json:"invoicePeriodEndDate,omitempty"` - // BillingProfileID - The billing profile id this invoice belongs to. + // BillingProfileID - READ-ONLY; The billing profile id this invoice belongs to. BillingProfileID *string `json:"billingProfileId,omitempty"` - // BillingProfileName - The profile name this invoice belongs to. + // BillingProfileName - READ-ONLY; The profile name this invoice belongs to. BillingProfileName *string `json:"billingProfileName,omitempty"` - // PurchaseOrderNumber - The purchase identifier for the invoice. + // PurchaseOrderNumber - READ-ONLY; The purchase identifier for the invoice. PurchaseOrderNumber *string `json:"purchaseOrderNumber,omitempty"` - // DocumentUrls - List of document urls available to download including invoice and tax documents. + // DocumentUrls - READ-ONLY; List of document urls available to download including invoice and tax documents. DocumentUrls *[]DownloadProperties `json:"documentUrls,omitempty"` - // Payments - List of payments. + // Payments - READ-ONLY; List of payments. Payments *[]PaymentProperties `json:"payments,omitempty"` } // Operation a Billing REST API operation. type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation}. + // Name - READ-ONLY; Operation name: {provider}/{resource}/{operation}. Name *string `json:"name,omitempty"` // Display - The object that represents the operation. Display *OperationDisplay `json:"display,omitempty"` @@ -1354,11 +1262,11 @@ type Operation struct { // OperationDisplay the object that represents the operation. type OperationDisplay struct { - // Provider - Service provider: Microsoft.Billing. + // Provider - READ-ONLY; Service provider: Microsoft.Billing. Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed: Invoice, etc. + // Resource - READ-ONLY; Resource on which the operation is performed: Invoice, etc. Resource *string `json:"resource,omitempty"` - // Operation - Operation type: Read, write, delete, etc. + // Operation - READ-ONLY; Operation type: Read, write, delete, etc. Operation *string `json:"operation,omitempty"` } @@ -1366,9 +1274,9 @@ type OperationDisplay struct { // to get the next set of results. type OperationListResult struct { autorest.Response `json:"-"` - // Value - List of billing operations supported by the Microsoft.Billing resource provider. + // Value - READ-ONLY; List of billing operations supported by the Microsoft.Billing resource provider. Value *[]Operation `json:"value,omitempty"` - // NextLink - URL to get the next set of operation list results if there are any. + // NextLink - READ-ONLY; URL to get the next set of operation list results if there are any. NextLink *string `json:"nextLink,omitempty"` } @@ -1511,7 +1419,7 @@ func NewOperationListResultPage(getNextPage func(context.Context, OperationListR // OperationStatus status of the Billing POST/PUT operation. type OperationStatus struct { - // ID - The operation Id. + // ID - READ-ONLY; The operation Id. ID *string `json:"id,omitempty"` // Status - Status of the pending operation Status *string `json:"status,omitempty"` @@ -1521,22 +1429,22 @@ type OperationStatus struct { // Participants details about the participant or signer. type Participants struct { - // Status - The signing status + // Status - READ-ONLY; The signing status Status *string `json:"status,omitempty"` - // StatusDate - The date when status got changed. + // StatusDate - READ-ONLY; The date when status got changed. StatusDate *date.Time `json:"statusDate,omitempty"` - // Email - The email address of the participant or signer. + // Email - READ-ONLY; 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"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -1546,15 +1454,6 @@ func (pm PaymentMethod) MarshalJSON() ([]byte, error) { if pm.PaymentMethodProperties != nil { objectMap["properties"] = pm.PaymentMethodProperties } - if pm.ID != nil { - objectMap["id"] = pm.ID - } - if pm.Name != nil { - objectMap["name"] = pm.Name - } - if pm.Type != nil { - objectMap["type"] = pm.Type - } return json.Marshal(objectMap) } @@ -1613,20 +1512,20 @@ func (pm *PaymentMethod) UnmarshalJSON(body []byte) error { type PaymentMethodProperties struct { // PaymentMethodType - Payment method type. Possible values include: 'Credits', 'ChequeWire' PaymentMethodType PaymentMethodType `json:"paymentMethodType,omitempty"` - // Details - Details about the payment method. + // Details - READ-ONLY; Details about the payment method. Details *string `json:"details,omitempty"` - // Expiration - Expiration date. + // Expiration - READ-ONLY; Expiration date. Expiration *date.Time `json:"expiration,omitempty"` - // Currency - The currency associated with the payment method. + // Currency - READ-ONLY; The currency associated with the payment method. Currency *string `json:"currency,omitempty"` } // PaymentMethodsListResult result of listing payment methods. type PaymentMethodsListResult struct { autorest.Response `json:"-"` - // Value - The list of payment methods. + // Value - READ-ONLY; The list of payment methods. Value *[]PaymentMethod `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -1769,38 +1668,39 @@ func NewPaymentMethodsListResultPage(getNextPage func(context.Context, PaymentMe // PaymentProperties the properties of the payment. type PaymentProperties struct { - // PaymentType - The type of payment. + // PaymentType - READ-ONLY; The type of payment. PaymentType *string `json:"paymentType,omitempty"` - // Amount - The paid amount. + // Amount - READ-ONLY; The paid amount. Amount *Amount `json:"amount,omitempty"` - // Date - The date of the payment. + // Date - READ-ONLY; The date of the payment. Date *date.Time `json:"date,omitempty"` } -// Permissions the set of allowed action and not allowed actions a caller has on a billing account -type Permissions struct { - // Actions - The set of actions that the caller is allowed to do - Actions *[]string `json:"actions,omitempty"` - // NotActions - The set of actions the caller is not allowed to do - NotActions *[]string `json:"notActions,omitempty"` -} - // PermissionsListResult result of list billingPermissions a caller has on a billing account. type PermissionsListResult struct { autorest.Response `json:"-"` - // Value - The list OF billingPermissions a caller has on a billing account. - Value *[]Permissions `json:"value,omitempty"` + // Value - READ-ONLY; The list OF billingPermissions a caller has on a billing account. + Value *[]PermissionsProperties `json:"value,omitempty"` +} + +// PermissionsProperties the set of allowed action and not allowed actions a caller has on a billing +// account +type PermissionsProperties struct { + // Actions - READ-ONLY; The set of actions that the caller is allowed to do + Actions *[]string `json:"actions,omitempty"` + // NotActions - READ-ONLY; The set of actions the caller is not allowed to do + NotActions *[]string `json:"notActions,omitempty"` } // Policy the Policy. type Policy struct { autorest.Response `json:"-"` *PolicyProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -1810,15 +1710,6 @@ func (p Policy) MarshalJSON() ([]byte, error) { if p.PolicyProperties != nil { objectMap["properties"] = p.PolicyProperties } - if p.ID != nil { - objectMap["id"] = p.ID - } - if p.Name != nil { - objectMap["name"] = p.Name - } - if p.Type != nil { - objectMap["type"] = p.Type - } return json.Marshal(objectMap) } @@ -1883,6 +1774,35 @@ type PolicyProperties struct { SubscriptionOwnerCanViewCharges *bool `json:"subscriptionOwnerCanViewCharges,omitempty"` } +// PriceSheetDownloadFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type PriceSheetDownloadFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *PriceSheetDownloadFuture) Result(client PriceSheetClient) (du DownloadURL, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PriceSheetDownloadFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("billing.PriceSheetDownloadFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if du.Response.Response, err = future.GetResult(sender); err == nil && du.Response.Response.StatusCode != http.StatusNoContent { + du, err = client.DownloadResponder(du.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PriceSheetDownloadFuture", "Result", du.Response.Response, "Failure responding to request") + } + } + return +} + // ProductDetails details of the product to be transferred. type ProductDetails struct { // ProductType - Type of the product to be transferred. Possible values include: 'ProductTypeAzureSubscription', 'ProductTypeAzureReservation' @@ -1895,9 +1815,9 @@ type ProductDetails struct { // summaries in reverse chronological order by purchase date. type ProductsListResult struct { autorest.Response `json:"-"` - // Value - The list of products summary. + // Value - READ-ONLY; The list of products summary. Value *[]ProductSummary `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -2042,11 +1962,11 @@ func NewProductsListResultPage(getNextPage func(context.Context, ProductsListRes type ProductSummary struct { autorest.Response `json:"-"` *ProductSummaryProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -2056,15 +1976,6 @@ func (ps ProductSummary) MarshalJSON() ([]byte, error) { if ps.ProductSummaryProperties != nil { objectMap["properties"] = ps.ProductSummaryProperties } - if ps.ID != nil { - objectMap["id"] = ps.ID - } - if ps.Name != nil { - objectMap["name"] = ps.Name - } - if ps.Type != nil { - objectMap["type"] = ps.Type - } return json.Marshal(objectMap) } @@ -2121,41 +2032,41 @@ func (ps *ProductSummary) UnmarshalJSON(body []byte) error { // ProductSummaryProperties the properties of the product summary. type ProductSummaryProperties struct { - // DisplayName - The display name of the product. + // DisplayName - READ-ONLY; The display name of the product. DisplayName *string `json:"displayName,omitempty"` - // PurchaseDate - The date of purchase. + // PurchaseDate - READ-ONLY; The date of purchase. PurchaseDate *date.Time `json:"purchaseDate,omitempty"` - // ProductTypeID - The product type id. + // ProductTypeID - READ-ONLY; The product type id. ProductTypeID *string `json:"productTypeId,omitempty"` - // ProductType - The type of product. + // ProductType - READ-ONLY; The type of product. ProductType *string `json:"productType,omitempty"` // Status - Product status. Possible values include: 'Active', 'Inactive', 'PastDue', 'Expiring', 'Expired', 'Disabled', 'Cancelled', 'AutoRenew' Status ProductStatusType `json:"status,omitempty"` - // EndDate - end date. + // EndDate - READ-ONLY; end date. EndDate *date.Time `json:"endDate,omitempty"` // BillingFrequency - Billing frequency. Possible values include: 'OneTime', 'Monthly', 'UsageBased' BillingFrequency Frequency `json:"billingFrequency,omitempty"` - // LastCharge - Last month charges. + // LastCharge - READ-ONLY; Last month charges. LastCharge *Amount `json:"lastCharge,omitempty"` - // LastChargeDate - The date of the last charge. + // LastChargeDate - READ-ONLY; The date of the last charge. LastChargeDate *date.Time `json:"lastChargeDate,omitempty"` - // Quantity - The purchased product quantity. + // Quantity - READ-ONLY; The purchased product quantity. Quantity *float64 `json:"quantity,omitempty"` - // SkuID - Sku Id. + // SkuID - READ-ONLY; Sku Id. SkuID *string `json:"skuId,omitempty"` - // SkuDescription - Sku description. + // SkuDescription - READ-ONLY; Sku description. SkuDescription *string `json:"skuDescription,omitempty"` - // AvailabilityID - Availability Id. + // AvailabilityID - READ-ONLY; Availability Id. AvailabilityID *string `json:"availabilityId,omitempty"` - // ParentProductID - Parent Product Id. + // ParentProductID - READ-ONLY; Parent Product Id. ParentProductID *string `json:"parentProductId,omitempty"` - // InvoiceSectionID - Invoice section id to which this product belongs. + // InvoiceSectionID - READ-ONLY; Invoice section id to which this product belongs. InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` - // InvoiceSectionName - Invoice section name to which this product belongs. + // InvoiceSectionName - READ-ONLY; Invoice section name to which this product belongs. InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` - // BillingProfileID - Billing Profile id to which this product belongs. + // BillingProfileID - READ-ONLY; Billing Profile id to which this product belongs. BillingProfileID *string `json:"billingProfileId,omitempty"` - // BillingProfileName - Billing Profile name to which this product belongs. + // BillingProfileName - READ-ONLY; Billing Profile name to which this product belongs. BillingProfileName *string `json:"billingProfileName,omitempty"` } @@ -2164,11 +2075,11 @@ type Profile struct { autorest.Response `json:"-"` // ProfileProperties - A billing profile. *ProfileProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -2178,15 +2089,6 @@ func (p Profile) MarshalJSON() ([]byte, error) { if p.ProfileProperties != nil { objectMap["properties"] = p.ProfileProperties } - if p.ID != nil { - objectMap["id"] = p.ID - } - if p.Name != nil { - objectMap["name"] = p.Name - } - if p.Type != nil { - objectMap["type"] = p.Type - } return json.Marshal(objectMap) } @@ -2244,9 +2146,9 @@ func (p *Profile) UnmarshalJSON(body []byte) error { // ProfileListResult result of listing billing profiles. type ProfileListResult struct { autorest.Response `json:"-"` - // Value - The list of billing profiles. + // Value - READ-ONLY; The list of billing profiles. Value *[]Profile `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -2258,13 +2160,13 @@ type ProfileProperties struct { PoNumber *string `json:"poNumber,omitempty"` // Address - Billing address. Address *Address `json:"address,omitempty"` - // InvoiceEmailOptIn - If the billing profile is opted in to receive invoices via email. + // InvoiceEmailOptIn - READ-ONLY; If the billing profile is opted in to receive invoices via email. InvoiceEmailOptIn *bool `json:"invoiceEmailOptIn,omitempty"` - // IsClassic - Is OMS bootstrapped billing profile. + // IsClassic - READ-ONLY; Is OMS bootstrapped billing profile. IsClassic *bool `json:"isClassic,omitempty"` - // InvoiceDay - Invoice day. + // InvoiceDay - READ-ONLY; Invoice day. InvoiceDay *int32 `json:"invoiceDay,omitempty"` - // Currency - The currency associated with the billing profile. + // Currency - READ-ONLY; The currency associated with the billing profile. Currency *string `json:"currency,omitempty"` // EnabledAzureSKUs - Information about the product. EnabledAzureSKUs *[]EnabledAzureSKUs `json:"enabledAzureSKUs,omitempty"` @@ -2282,7 +2184,7 @@ type ProfilesUpdateFuture struct { // If the operation has not completed it will return an error. func (future *ProfilesUpdateFuture) Result(client ProfilesClient) (p Profile, err error) { var done bool - done, err = future.Done(client) + done, err = future.DoneWithContext(context.Background(), client) if err != nil { err = autorest.NewErrorWithError(err, "billing.ProfilesUpdateFuture", "Result", future.Response(), "Polling failure") return @@ -2306,11 +2208,11 @@ type Property struct { autorest.Response `json:"-"` // PropertySummary - A billing property. *PropertySummary `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -2320,15 +2222,6 @@ func (p Property) MarshalJSON() ([]byte, error) { if p.PropertySummary != nil { objectMap["properties"] = p.PropertySummary } - if p.ID != nil { - objectMap["id"] = p.ID - } - if p.Name != nil { - objectMap["name"] = p.Name - } - if p.Type != nil { - objectMap["type"] = p.Type - } return json.Marshal(objectMap) } @@ -2385,29 +2278,29 @@ func (p *Property) UnmarshalJSON(body []byte) error { // PropertySummary the billing property. type PropertySummary struct { - // BillingTenantID - Billing tenant Id. + // BillingTenantID - READ-ONLY; Billing tenant Id. BillingTenantID *string `json:"billingTenantId,omitempty"` - // BillingAccountID - Billing account Id. + // BillingAccountID - READ-ONLY; Billing account Id. BillingAccountID *string `json:"billingAccountId,omitempty"` - // BillingAccountName - Billing account name. + // BillingAccountName - READ-ONLY; Billing account name. BillingAccountName *string `json:"billingAccountName,omitempty"` - // BillingProfileID - Billing profile Id. + // BillingProfileID - READ-ONLY; Billing profile Id. BillingProfileID *string `json:"billingProfileId,omitempty"` - // BillingProfileName - Billing profile name. + // BillingProfileName - READ-ONLY; Billing profile name. BillingProfileName *string `json:"billingProfileName,omitempty"` - // CostCenter - Cost center name. + // CostCenter - READ-ONLY; Cost center name. CostCenter *string `json:"costCenter,omitempty"` - // InvoiceSectionID - Invoice Section Id. + // InvoiceSectionID - READ-ONLY; Invoice Section Id. InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` - // InvoiceSectionName - Invoice Section name. + // InvoiceSectionName - READ-ONLY; Invoice Section name. InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` - // ProductID - Product Id. + // ProductID - READ-ONLY; Product Id. ProductID *string `json:"productId,omitempty"` - // ProductName - Product name. + // ProductName - READ-ONLY; Product name. ProductName *string `json:"productName,omitempty"` - // SkuID - SKU Id. + // SkuID - READ-ONLY; SKU Id. SkuID *string `json:"skuId,omitempty"` - // SkuDescription - SKU description. + // SkuDescription - READ-ONLY; SKU description. SkuDescription *string `json:"skuDescription,omitempty"` } @@ -2454,9 +2347,9 @@ func (rtd *RecipientTransferDetails) UnmarshalJSON(body []byte) error { // RecipientTransferDetailsListResult result of listing details of the transfer received by caller. type RecipientTransferDetailsListResult struct { autorest.Response `json:"-"` - // Value - The list of transfers received by caller. + // Value - READ-ONLY; The list of transfers received by caller. Value *[]RecipientTransferDetails `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -2600,33 +2493,33 @@ func NewRecipientTransferDetailsListResultPage(getNextPage func(context.Context, // RecipientTransferProperties transfer Details. type RecipientTransferProperties struct { - // CreationTime - Transfer creation time. + // CreationTime - READ-ONLY; Transfer creation time. CreationTime *date.Time `json:"creationTime,omitempty"` - // ExpirationTime - Transfer expiration time. + // ExpirationTime - READ-ONLY; Transfer expiration time. ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // AllowedProductType - Type of subscriptions that can be transferred. + // AllowedProductType - READ-ONLY; Type of subscriptions that can be transferred. AllowedProductType *[]EligibleProductType `json:"allowedProductType,omitempty"` - // TransferStatus - Overall transfer status. Possible values include: 'TransferStatusPending', 'TransferStatusInProgress', 'TransferStatusCompleted', 'TransferStatusCompletedWithErrors', 'TransferStatusFailed', 'TransferStatusCanceled', 'TransferStatusDeclined' + // TransferStatus - READ-ONLY; Overall transfer status. Possible values include: 'TransferStatusPending', 'TransferStatusInProgress', 'TransferStatusCompleted', 'TransferStatusCompletedWithErrors', 'TransferStatusFailed', 'TransferStatusCanceled', 'TransferStatusDeclined' TransferStatus TransferStatus `json:"transferStatus,omitempty"` - // RecipientEmailID - Email Id of recipient of transfer. + // RecipientEmailID - READ-ONLY; Email Id of recipient of transfer. RecipientEmailID *string `json:"recipientEmailId,omitempty"` - // InitiatorEmailID - Email Id of initiator of transfer. + // InitiatorEmailID - READ-ONLY; Email Id of initiator of transfer. InitiatorEmailID *string `json:"initiatorEmailId,omitempty"` - // CanceledBy - Email Id who user canceled the transfer. + // CanceledBy - READ-ONLY; Email Id who user canceled the transfer. CanceledBy *string `json:"canceledBy,omitempty"` - // LastModifiedTime - Transfer last modification time. + // LastModifiedTime - READ-ONLY; Transfer last modification time. LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // DetailedTransferStatus - Detailed transfer status. + // DetailedTransferStatus - READ-ONLY; Detailed transfer status. DetailedTransferStatus *[]DetailedTransferStatus `json:"detailedTransferStatus,omitempty"` } // Resource the Resource model definition. type Resource struct { - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -2635,11 +2528,11 @@ type RoleAssignment struct { autorest.Response `json:"-"` // RoleAssignmentProperties - The role assignment the caller has *RoleAssignmentProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -2649,15 +2542,6 @@ func (ra RoleAssignment) MarshalJSON() ([]byte, error) { if ra.RoleAssignmentProperties != nil { objectMap["properties"] = ra.RoleAssignmentProperties } - if ra.ID != nil { - objectMap["id"] = ra.ID - } - if ra.Name != nil { - objectMap["name"] = ra.Name - } - if ra.Type != nil { - objectMap["type"] = ra.Type - } return json.Marshal(objectMap) } @@ -2715,33 +2599,33 @@ func (ra *RoleAssignment) UnmarshalJSON(body []byte) error { // RoleAssignmentListResult result of get list of role assignments type RoleAssignmentListResult struct { autorest.Response `json:"-"` - // Value - The list role assignments + // Value - READ-ONLY; The list role assignments Value *[]RoleAssignment `json:"value,omitempty"` } // RoleAssignmentPayload the payload use to update role assignment on a scope type RoleAssignmentPayload struct { - // PrincipalID - The user's principal id that the role gets assigned to + // PrincipalID - READ-ONLY; The user's principal id that the role gets assigned to PrincipalID *string `json:"principalId,omitempty"` - // BillingRoleDefinitionName - The role definition id + // BillingRoleDefinitionName - READ-ONLY; The role definition id BillingRoleDefinitionName *string `json:"billingRoleDefinitionName,omitempty"` } // RoleAssignmentProperties the properties of the a role assignment. type RoleAssignmentProperties struct { - // CreatedOn - the date the role assignment is created + // CreatedOn - READ-ONLY; the date the role assignment is created CreatedOn *string `json:"createdOn,omitempty"` - // CreatedByPrincipalTenantID - the creator's tenant Id + // CreatedByPrincipalTenantID - READ-ONLY; the creator's tenant Id CreatedByPrincipalTenantID *string `json:"createdByPrincipalTenantId,omitempty"` - // CreatedByPrincipalID - the creator's principal Id + // CreatedByPrincipalID - READ-ONLY; the creator's principal Id CreatedByPrincipalID *string `json:"createdByPrincipalId,omitempty"` - // Name - the name of the role assignment + // Name - READ-ONLY; the name of the role assignment Name *string `json:"name,omitempty"` - // PrincipalID - The user's principal id that the role gets assigned to + // PrincipalID - READ-ONLY; The user's principal id that the role gets assigned to PrincipalID *string `json:"principalId,omitempty"` - // RoleDefinitionName - The role definition id + // RoleDefinitionName - READ-ONLY; The role definition id RoleDefinitionName *string `json:"roleDefinitionName,omitempty"` - // Scope - The scope the role get assigned to + // Scope - READ-ONLY; The scope the role get assigned to Scope *string `json:"scope,omitempty"` } @@ -2750,11 +2634,11 @@ type RoleDefinition struct { autorest.Response `json:"-"` // RoleDefinitionProperties - The role definition for a role. *RoleDefinitionProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -2764,15 +2648,6 @@ func (rd RoleDefinition) MarshalJSON() ([]byte, error) { if rd.RoleDefinitionProperties != nil { objectMap["properties"] = rd.RoleDefinitionProperties } - if rd.ID != nil { - objectMap["id"] = rd.ID - } - if rd.Name != nil { - objectMap["name"] = rd.Name - } - if rd.Type != nil { - objectMap["type"] = rd.Type - } return json.Marshal(objectMap) } @@ -2830,32 +2705,26 @@ func (rd *RoleDefinition) UnmarshalJSON(body []byte) error { // RoleDefinitionListResult list the role definitions. type RoleDefinitionListResult struct { autorest.Response `json:"-"` - // Value - The list of role definitions. + // Value - READ-ONLY; The list of role definitions. Value *[]RoleDefinition `json:"value,omitempty"` } // RoleDefinitionProperties the properties of the a role definition. type RoleDefinitionProperties struct { - // Description - The role description + // Description - READ-ONLY; The role description Description *string `json:"description,omitempty"` // PermissionsListResult - The billingPermissions the role has *PermissionsListResult `json:"permissions,omitempty"` - // RoleName - The name of the role + // RoleName - READ-ONLY; The name of the role RoleName *string `json:"roleName,omitempty"` } // MarshalJSON is the custom marshaler for RoleDefinitionProperties. func (rdp RoleDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rdp.Description != nil { - objectMap["description"] = rdp.Description - } if rdp.PermissionsListResult != nil { objectMap["permissions"] = rdp.PermissionsListResult } - if rdp.RoleName != nil { - objectMap["roleName"] = rdp.RoleName - } return json.Marshal(objectMap) } @@ -2903,36 +2772,36 @@ func (rdp *RoleDefinitionProperties) UnmarshalJSON(body []byte) error { // SubscriptionProperties the usage context properties. type SubscriptionProperties struct { - // DisplayName - display name. + // DisplayName - READ-ONLY; display name. DisplayName *string `json:"displayName,omitempty"` - // SubscriptionID - Subscription Id. + // SubscriptionID - READ-ONLY; Subscription Id. SubscriptionID *uuid.UUID `json:"subscriptionId,omitempty"` // SubscriptionBillingStatus - Subscription billing status. Possible values include: 'SubscriptionStatusTypeActive', 'SubscriptionStatusTypeInactive', 'SubscriptionStatusTypeAbandoned', 'SubscriptionStatusTypeDeleted', 'SubscriptionStatusTypeWarning' SubscriptionBillingStatus SubscriptionStatusType `json:"subscriptionBillingStatus,omitempty"` - // LastMonthCharges - Last month charges. + // LastMonthCharges - READ-ONLY; Last month charges. LastMonthCharges *Amount `json:"lastMonthCharges,omitempty"` - // MonthToDateCharges - Month to date charges. + // MonthToDateCharges - READ-ONLY; Month to date charges. MonthToDateCharges *Amount `json:"monthToDateCharges,omitempty"` - // BillingProfileID - Billing Profile id to which this product belongs. + // BillingProfileID - READ-ONLY; Billing Profile id to which this product belongs. BillingProfileID *string `json:"billingProfileId,omitempty"` - // BillingProfileName - Billing Profile name to which this product belongs. + // BillingProfileName - READ-ONLY; Billing Profile name to which this product belongs. BillingProfileName *string `json:"billingProfileName,omitempty"` - // InvoiceSectionID - Invoice section id to which this product belongs. + // InvoiceSectionID - READ-ONLY; Invoice section id to which this product belongs. InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` - // InvoiceSectionName - Invoice section name to which this product belongs. + // InvoiceSectionName - READ-ONLY; Invoice section name to which this product belongs. InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` // SkuID - The sku id. SkuID *string `json:"skuId,omitempty"` - // SkuDescription - The sku description. + // SkuDescription - READ-ONLY; The sku description. SkuDescription *string `json:"skuDescription,omitempty"` } // SubscriptionsListResult result of listing billing subscriptions summary. type SubscriptionsListResult struct { autorest.Response `json:"-"` - // Value - The list of billing subscriptions summary. + // Value - READ-ONLY; The list of billing subscriptions summary. Value *[]SubscriptionSummary `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -3073,15 +2942,44 @@ func NewSubscriptionsListResultPage(getNextPage func(context.Context, Subscripti return SubscriptionsListResultPage{fn: getNextPage} } +// SubscriptionsTransferFuture an abstraction for monitoring and retrieving the results of a long-running +// operation. +type SubscriptionsTransferFuture struct { + azure.Future +} + +// Result returns the result of the asynchronous operation. +// If the operation has not completed it will return an error. +func (future *SubscriptionsTransferFuture) Result(client SubscriptionsClient) (tbsr TransferBillingSubscriptionResult, err error) { + var done bool + done, err = future.DoneWithContext(context.Background(), client) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsTransferFuture", "Result", future.Response(), "Polling failure") + return + } + if !done { + err = azure.NewAsyncOpIncompleteError("billing.SubscriptionsTransferFuture") + return + } + sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if tbsr.Response.Response, err = future.GetResult(sender); err == nil && tbsr.Response.Response.StatusCode != http.StatusNoContent { + tbsr, err = client.TransferResponder(tbsr.Response.Response) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsTransferFuture", "Result", tbsr.Response.Response, "Failure responding to request") + } + } + return +} + // SubscriptionSummary a billing Subscription summary resource. type SubscriptionSummary struct { autorest.Response `json:"-"` *SubscriptionProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -3091,15 +2989,6 @@ func (ss SubscriptionSummary) MarshalJSON() ([]byte, error) { if ss.SubscriptionProperties != nil { objectMap["properties"] = ss.SubscriptionProperties } - if ss.ID != nil { - objectMap["id"] = ss.ID - } - if ss.Name != nil { - objectMap["name"] = ss.Name - } - if ss.Type != nil { - objectMap["type"] = ss.Type - } return json.Marshal(objectMap) } @@ -3154,41 +3043,12 @@ func (ss *SubscriptionSummary) UnmarshalJSON(body []byte) error { return nil } -// SubscriptionTransferFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubscriptionTransferFuture struct { - azure.Future -} - -// Result returns the result of the asynchronous operation. -// If the operation has not completed it will return an error. -func (future *SubscriptionTransferFuture) Result(client SubscriptionClient) (tbsr TransferBillingSubscriptionResult, err error) { - var done bool - done, err = future.Done(client) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionTransferFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - err = azure.NewAsyncOpIncompleteError("billing.SubscriptionTransferFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if tbsr.Response.Response, err = future.GetResult(sender); err == nil && tbsr.Response.Response.StatusCode != http.StatusNoContent { - tbsr, err = client.TransferResponder(tbsr.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionTransferFuture", "Result", tbsr.Response.Response, "Failure responding to request") - } - } - return -} - // TransactionsListResult result of listing reservation transactions summary. type TransactionsListResult struct { autorest.Response `json:"-"` - // Value - The list of reservation transactions summary. + // Value - READ-ONLY; The list of reservation transactions summary. Value *[]TransactionsSummary `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -3332,11 +3192,11 @@ func NewTransactionsListResultPage(getNextPage func(context.Context, Transaction // TransactionsSummary a reservation transaction summary resource. type TransactionsSummary struct { *TransactionsSummaryProperties `json:"properties,omitempty"` - // ID - Resource Id. + // ID - READ-ONLY; Resource Id. ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; Resource name. Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; Resource type. Type *string `json:"type,omitempty"` } @@ -3346,15 +3206,6 @@ func (ts TransactionsSummary) MarshalJSON() ([]byte, error) { if ts.TransactionsSummaryProperties != nil { objectMap["properties"] = ts.TransactionsSummaryProperties } - if ts.ID != nil { - objectMap["id"] = ts.ID - } - if ts.Name != nil { - objectMap["name"] = ts.Name - } - if ts.Type != nil { - objectMap["type"] = ts.Type - } return json.Marshal(objectMap) } @@ -3413,39 +3264,39 @@ func (ts *TransactionsSummary) UnmarshalJSON(body []byte) error { type TransactionsSummaryProperties struct { // Kind - The kind of transaction. Choices are all and reservation. Possible values include: 'All', 'Reservation' Kind TransactionTypeKind `json:"kind,omitempty"` - // Date - The date of reservation transaction. + // Date - READ-ONLY; The date of reservation transaction. Date *date.Time `json:"date,omitempty"` - // Invoice - Invoice number or 'pending' if not invoiced. + // Invoice - READ-ONLY; Invoice number or 'pending' if not invoiced. Invoice *string `json:"invoice,omitempty"` - // OrderID - The reservation order id. + // OrderID - READ-ONLY; The reservation order id. OrderID *string `json:"orderId,omitempty"` - // OrderName - The reservation order name. + // OrderName - READ-ONLY; The reservation order name. OrderName *string `json:"orderName,omitempty"` - // ProductFamily - The product family. + // ProductFamily - READ-ONLY; The product family. ProductFamily *string `json:"productFamily,omitempty"` - // ProductTypeID - The product type id. + // ProductTypeID - READ-ONLY; The product type id. ProductTypeID *string `json:"productTypeId,omitempty"` - // ProductType - The type of product. + // ProductType - READ-ONLY; The type of product. ProductType *string `json:"productType,omitempty"` - // ProductDescription - Product description. + // ProductDescription - READ-ONLY; Product description. ProductDescription *string `json:"productDescription,omitempty"` // TransactionType - Transaction types. Possible values include: 'Purchase', 'UsageCharge' TransactionType ReservationType `json:"transactionType,omitempty"` - // TransactionAmount - Last charge associated with the purchase. + // TransactionAmount - READ-ONLY; Last charge associated with the purchase. TransactionAmount *Amount `json:"transactionAmount,omitempty"` - // Quantity - Purchase quantity. + // Quantity - READ-ONLY; Purchase quantity. Quantity *int32 `json:"quantity,omitempty"` - // InvoiceSectionID - Invoice section id to which this product belongs. + // InvoiceSectionID - READ-ONLY; Invoice section id to which this product belongs. InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` - // InvoiceSectionName - Invoice section name to which this product belongs. + // InvoiceSectionName - READ-ONLY; Invoice section name to which this product belongs. InvoiceSectionName *string `json:"invoiceSectionName,omitempty"` - // BillingProfileID - Billing Profile id to which this product belongs. + // BillingProfileID - READ-ONLY; Billing Profile id to which this product belongs. BillingProfileID *string `json:"billingProfileId,omitempty"` - // BillingProfileName - Billing Profile name to which this product belongs. + // BillingProfileName - READ-ONLY; Billing Profile name to which this product belongs. BillingProfileName *string `json:"billingProfileName,omitempty"` - // SubscriptionID - The subscription id. + // SubscriptionID - READ-ONLY; The subscription id. SubscriptionID *string `json:"subscriptionId,omitempty"` - // SubscriptionName - The subscription name. + // SubscriptionName - READ-ONLY; The subscription name. SubscriptionName *string `json:"subscriptionName,omitempty"` } @@ -3583,9 +3434,9 @@ func (td *TransferDetails) UnmarshalJSON(body []byte) error { // TransferDetailsListResult result of listing details of the transfer initiated by caller. type TransferDetailsListResult struct { autorest.Response `json:"-"` - // Value - The list of transfers initiated by caller. + // Value - READ-ONLY; The list of transfers initiated by caller. Value *[]TransferDetails `json:"value,omitempty"` - // NextLink - The link (url) to the next page of results. + // NextLink - READ-ONLY; The link (url) to the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -3734,25 +3585,25 @@ type TransferProductRequestProperties struct { // TransferProperties transfer details type TransferProperties struct { - // CreationTime - Transfer creation time. + // CreationTime - READ-ONLY; Transfer creation time. CreationTime *date.Time `json:"creationTime,omitempty"` - // ExpirationTime - Transfer expiration time. + // ExpirationTime - READ-ONLY; Transfer expiration time. ExpirationTime *date.Time `json:"expirationTime,omitempty"` - // InvoiceSectionID - Target invoice section Id. + // InvoiceSectionID - READ-ONLY; Target invoice section Id. InvoiceSectionID *string `json:"invoiceSectionId,omitempty"` - // BillingAccountID - Target billing account Id. + // BillingAccountID - READ-ONLY; Target billing account Id. BillingAccountID *string `json:"billingAccountId,omitempty"` - // TransferStatus - Overall transfer status. Possible values include: 'TransferStatusPending', 'TransferStatusInProgress', 'TransferStatusCompleted', 'TransferStatusCompletedWithErrors', 'TransferStatusFailed', 'TransferStatusCanceled', 'TransferStatusDeclined' + // TransferStatus - READ-ONLY; Overall transfer status. Possible values include: 'TransferStatusPending', 'TransferStatusInProgress', 'TransferStatusCompleted', 'TransferStatusCompletedWithErrors', 'TransferStatusFailed', 'TransferStatusCanceled', 'TransferStatusDeclined' TransferStatus TransferStatus `json:"transferStatus,omitempty"` - // RecipientEmailID - Email Id of recipient of transfer. + // RecipientEmailID - READ-ONLY; Email Id of recipient of transfer. RecipientEmailID *string `json:"recipientEmailId,omitempty"` - // InitiatorEmailID - Email Id of initiator of transfer. + // InitiatorEmailID - READ-ONLY; Email Id of initiator of transfer. InitiatorEmailID *string `json:"initiatorEmailId,omitempty"` - // CanceledBy - Email Id who user canceled the transfer. + // CanceledBy - READ-ONLY; Email Id who user canceled the transfer. CanceledBy *string `json:"canceledBy,omitempty"` - // LastModifiedTime - Transfer last modification time. + // LastModifiedTime - READ-ONLY; Transfer last modification time. LastModifiedTime *date.Time `json:"lastModifiedTime,omitempty"` - // DetailedTransferStatus - Detailed transfer status. + // DetailedTransferStatus - READ-ONLY; Detailed transfer status. DetailedTransferStatus *[]DetailedTransferStatus `json:"detailedTransferStatus,omitempty"` } diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/paymentmethods.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/paymentmethods.go new file mode 100644 index 000000000000..3bb9ed775c69 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/paymentmethods.go @@ -0,0 +1,155 @@ +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" +) + +// PaymentMethodsClient is the billing client provides access to billing resources for Azure subscriptions. +type PaymentMethodsClient struct { + BaseClient +} + +// NewPaymentMethodsClient creates an instance of the PaymentMethodsClient client. +func NewPaymentMethodsClient(subscriptionID string) PaymentMethodsClient { + return NewPaymentMethodsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPaymentMethodsClientWithBaseURI creates an instance of the PaymentMethodsClient client. +func NewPaymentMethodsClientWithBaseURI(baseURI string, subscriptionID string) PaymentMethodsClient { + return PaymentMethodsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByBillingProfileName lists the Payment Methods by billing profile Id. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +func (client PaymentMethodsClient) ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result PaymentMethodsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PaymentMethodsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.pmlr.Response.Response != nil { + sc = result.pmlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByBillingProfileNameNextResults + req, err := client.ListByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PaymentMethodsClient", "ListByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.pmlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.PaymentMethodsClient", "ListByBillingProfileName", resp, "Failure sending request") + return + } + + result.pmlr, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PaymentMethodsClient", "ListByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfileNamePreparer prepares the ListByBillingProfileName request. +func (client PaymentMethodsClient) ListByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileNameSender sends the ListByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client PaymentMethodsClient) ListByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileNameResponder handles the response to the ListByBillingProfileName request. The method always +// closes the http.Response Body. +func (client PaymentMethodsClient) ListByBillingProfileNameResponder(resp *http.Response) (result PaymentMethodsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBillingProfileNameNextResults retrieves the next set of results, if any. +func (client PaymentMethodsClient) listByBillingProfileNameNextResults(ctx context.Context, lastResults PaymentMethodsListResult) (result PaymentMethodsListResult, err error) { + req, err := lastResults.paymentMethodsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.PaymentMethodsClient", "listByBillingProfileNameNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.PaymentMethodsClient", "listByBillingProfileNameNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PaymentMethodsClient", "listByBillingProfileNameNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBillingProfileNameComplete enumerates all values, automatically crossing page boundaries as required. +func (client PaymentMethodsClient) ListByBillingProfileNameComplete(ctx context.Context, billingAccountName string, billingProfileName string) (result PaymentMethodsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PaymentMethodsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBillingProfileName(ctx, billingAccountName, billingProfileName) + return +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/paymentmethodsbybillingprofile.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/paymentmethodsbybillingprofile.go deleted file mode 100644 index 2b7675f2b57d..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/paymentmethodsbybillingprofile.go +++ /dev/null @@ -1,157 +0,0 @@ -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" -) - -// PaymentMethodsByBillingProfileClient is the billing client provides access to billing resources for Azure -// subscriptions. -type PaymentMethodsByBillingProfileClient struct { - BaseClient -} - -// NewPaymentMethodsByBillingProfileClient creates an instance of the PaymentMethodsByBillingProfileClient client. -func NewPaymentMethodsByBillingProfileClient(subscriptionID string) PaymentMethodsByBillingProfileClient { - return NewPaymentMethodsByBillingProfileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPaymentMethodsByBillingProfileClientWithBaseURI creates an instance of the PaymentMethodsByBillingProfileClient -// client. -func NewPaymentMethodsByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) PaymentMethodsByBillingProfileClient { - return PaymentMethodsByBillingProfileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the Payment Methods by billing profile Id. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -func (client PaymentMethodsByBillingProfileClient) List(ctx context.Context, billingAccountName string, billingProfileName string) (result PaymentMethodsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PaymentMethodsByBillingProfileClient.List") - defer func() { - sc := -1 - if result.pmlr.Response.Response != nil { - sc = result.pmlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, billingAccountName, billingProfileName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PaymentMethodsByBillingProfileClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.pmlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.PaymentMethodsByBillingProfileClient", "List", resp, "Failure sending request") - return - } - - result.pmlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PaymentMethodsByBillingProfileClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client PaymentMethodsByBillingProfileClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/paymentMethods", 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 PaymentMethodsByBillingProfileClient) 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 PaymentMethodsByBillingProfileClient) ListResponder(resp *http.Response) (result PaymentMethodsListResult, 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 PaymentMethodsByBillingProfileClient) listNextResults(ctx context.Context, lastResults PaymentMethodsListResult) (result PaymentMethodsListResult, err error) { - req, err := lastResults.paymentMethodsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.PaymentMethodsByBillingProfileClient", "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, "billing.PaymentMethodsByBillingProfileClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.PaymentMethodsByBillingProfileClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PaymentMethodsByBillingProfileClient) ListComplete(ctx context.Context, billingAccountName string, billingProfileName string) (result PaymentMethodsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PaymentMethodsByBillingProfileClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, billingAccountName, billingProfileName) - return -} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/permissions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/permissions.go new file mode 100644 index 000000000000..17d9dd91d6d4 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/permissions.go @@ -0,0 +1,267 @@ +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" +) + +// PermissionsClient is the billing client provides access to billing resources for Azure subscriptions. +type PermissionsClient struct { + BaseClient +} + +// NewPermissionsClient creates an instance of the PermissionsClient client. +func NewPermissionsClient(subscriptionID string) PermissionsClient { + return NewPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewPermissionsClientWithBaseURI creates an instance of the PermissionsClient client. +func NewPermissionsClientWithBaseURI(baseURI string, subscriptionID string) PermissionsClient { + return PermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByBillingAccount lists all billing permissions for the caller under a billing account. +// Parameters: +// billingAccountName - billing Account Id. +func (client PermissionsClient) ListByBillingAccount(ctx context.Context, billingAccountName string) (result PermissionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListByBillingAccount") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingAccountPreparer(ctx, billingAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByBillingAccount", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByBillingAccount", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByBillingAccount", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountPreparer prepares the ListByBillingAccount request. +func (client PermissionsClient) ListByBillingAccountPreparer(ctx context.Context, billingAccountName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingPermissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingAccountSender sends the ListByBillingAccount request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListByBillingAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingAccountResponder handles the response to the ListByBillingAccount request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListByBillingAccountResponder(resp *http.Response) (result PermissionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBillingProfile lists all billingPermissions for the caller has for a billing account. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +func (client PermissionsClient) ListByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result PermissionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListByBillingProfile") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfilePreparer(ctx, billingAccountName, billingProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByBillingProfile", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByBillingProfile", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByBillingProfile", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfilePreparer prepares the ListByBillingProfile request. +func (client PermissionsClient) ListByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileSender sends the ListByBillingProfile request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListByBillingProfileSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileResponder handles the response to the ListByBillingProfile request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListByBillingProfileResponder(resp *http.Response) (result PermissionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInvoiceSections lists all billing permissions for the caller under invoice section. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +func (client PermissionsClient) ListByInvoiceSections(ctx context.Context, billingAccountName string, invoiceSectionName string) (result PermissionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/PermissionsClient.ListByInvoiceSections") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByInvoiceSectionsPreparer(ctx, billingAccountName, invoiceSectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByInvoiceSections", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInvoiceSectionsSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByInvoiceSections", resp, "Failure sending request") + return + } + + result, err = client.ListByInvoiceSectionsResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.PermissionsClient", "ListByInvoiceSections", resp, "Failure responding to request") + } + + return +} + +// ListByInvoiceSectionsPreparer prepares the ListByInvoiceSections request. +func (client PermissionsClient) ListByInvoiceSectionsPreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingPermissions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInvoiceSectionsSender sends the ListByInvoiceSections request. The method will close the +// http.Response Body if it receives an error. +func (client PermissionsClient) ListByInvoiceSectionsSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByInvoiceSectionsResponder handles the response to the ListByInvoiceSections request. The method always +// closes the http.Response Body. +func (client PermissionsClient) ListByInvoiceSectionsResponder(resp *http.Response) (result PermissionsListResult, 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/policy.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/policies.go similarity index 61% rename from services/preview/billing/mgmt/2018-11-01-preview/billing/policy.go rename to services/preview/billing/mgmt/2018-11-01-preview/billing/policies.go index 65c1bf805077..fb12bc5489db 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/policy.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/policies.go @@ -25,28 +25,28 @@ import ( "net/http" ) -// PolicyClient is the billing client provides access to billing resources for Azure subscriptions. -type PolicyClient struct { +// PoliciesClient is the billing client provides access to billing resources for Azure subscriptions. +type PoliciesClient struct { BaseClient } -// NewPolicyClient creates an instance of the PolicyClient client. -func NewPolicyClient(subscriptionID string) PolicyClient { - return NewPolicyClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewPoliciesClient creates an instance of the PoliciesClient client. +func NewPoliciesClient(subscriptionID string) PoliciesClient { + return NewPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewPolicyClientWithBaseURI creates an instance of the PolicyClient client. -func NewPolicyClientWithBaseURI(baseURI string, subscriptionID string) PolicyClient { - return PolicyClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewPoliciesClientWithBaseURI creates an instance of the PoliciesClient client. +func NewPoliciesClientWithBaseURI(baseURI string, subscriptionID string) PoliciesClient { + return PoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} } -// GetByBillingProfile the policy for a given billingAccountName and billingProfileName. +// GetByBillingProfileName the policy for a given billing account name and billing profile name. // Parameters: // billingAccountName - billing Account Id. // billingProfileName - billing Profile Id. -func (client PolicyClient) GetByBillingProfile(ctx context.Context, billingAccountName string, billingProfileName string) (result Policy, err error) { +func (client PoliciesClient) GetByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result Policy, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.GetByBillingProfile") + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.GetByBillingProfileName") defer func() { sc := -1 if result.Response.Response != nil { @@ -55,29 +55,29 @@ func (client PolicyClient) GetByBillingProfile(ctx context.Context, billingAccou tracing.EndSpan(ctx, sc, err) }() } - req, err := client.GetByBillingProfilePreparer(ctx, billingAccountName, billingProfileName) + req, err := client.GetByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName) if err != nil { - err = autorest.NewErrorWithError(err, "billing.PolicyClient", "GetByBillingProfile", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "billing.PoliciesClient", "GetByBillingProfileName", nil, "Failure preparing request") return } - resp, err := client.GetByBillingProfileSender(req) + resp, err := client.GetByBillingProfileNameSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.PolicyClient", "GetByBillingProfile", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "billing.PoliciesClient", "GetByBillingProfileName", resp, "Failure sending request") return } - result, err = client.GetByBillingProfileResponder(resp) + result, err = client.GetByBillingProfileNameResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "billing.PolicyClient", "GetByBillingProfile", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "billing.PoliciesClient", "GetByBillingProfileName", resp, "Failure responding to request") } return } -// GetByBillingProfilePreparer prepares the GetByBillingProfile request. -func (client PolicyClient) GetByBillingProfilePreparer(ctx context.Context, billingAccountName string, billingProfileName string) (*http.Request, error) { +// GetByBillingProfileNamePreparer prepares the GetByBillingProfileName request. +func (client PoliciesClient) GetByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "billingAccountName": autorest.Encode("path", billingAccountName), "billingProfileName": autorest.Encode("path", billingProfileName), @@ -96,16 +96,16 @@ func (client PolicyClient) GetByBillingProfilePreparer(ctx context.Context, bill return preparer.Prepare((&http.Request{}).WithContext(ctx)) } -// GetByBillingProfileSender sends the GetByBillingProfile request. The method will close the +// GetByBillingProfileNameSender sends the GetByBillingProfileName request. The method will close the // http.Response Body if it receives an error. -func (client PolicyClient) GetByBillingProfileSender(req *http.Request) (*http.Response, error) { +func (client PoliciesClient) GetByBillingProfileNameSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } -// GetByBillingProfileResponder handles the response to the GetByBillingProfile request. The method always +// GetByBillingProfileNameResponder handles the response to the GetByBillingProfileName request. The method always // closes the http.Response Body. -func (client PolicyClient) GetByBillingProfileResponder(resp *http.Response) (result Policy, err error) { +func (client PoliciesClient) GetByBillingProfileNameResponder(resp *http.Response) (result Policy, err error) { err = autorest.Respond( resp, client.ByInspecting(), @@ -121,9 +121,9 @@ func (client PolicyClient) GetByBillingProfileResponder(resp *http.Response) (re // billingAccountName - billing Account Id. // billingProfileName - billing Profile Id. // parameters - parameters supplied to the update policy operation. -func (client PolicyClient) Update(ctx context.Context, billingAccountName string, billingProfileName string, parameters Policy) (result Policy, err error) { +func (client PoliciesClient) Update(ctx context.Context, billingAccountName string, billingProfileName string, parameters Policy) (result Policy, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PolicyClient.Update") + ctx = tracing.StartSpan(ctx, fqdn+"/PoliciesClient.Update") defer func() { sc := -1 if result.Response.Response != nil { @@ -134,27 +134,27 @@ func (client PolicyClient) Update(ctx context.Context, billingAccountName string } req, err := client.UpdatePreparer(ctx, billingAccountName, billingProfileName, parameters) if err != nil { - err = autorest.NewErrorWithError(err, "billing.PolicyClient", "Update", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "billing.PoliciesClient", "Update", nil, "Failure preparing request") return } resp, err := client.UpdateSender(req) if err != nil { result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.PolicyClient", "Update", resp, "Failure sending request") + err = autorest.NewErrorWithError(err, "billing.PoliciesClient", "Update", resp, "Failure sending request") return } result, err = client.UpdateResponder(resp) if err != nil { - err = autorest.NewErrorWithError(err, "billing.PolicyClient", "Update", resp, "Failure responding to request") + err = autorest.NewErrorWithError(err, "billing.PoliciesClient", "Update", resp, "Failure responding to request") } return } // UpdatePreparer prepares the Update request. -func (client PolicyClient) UpdatePreparer(ctx context.Context, billingAccountName string, billingProfileName string, parameters Policy) (*http.Request, error) { +func (client PoliciesClient) UpdatePreparer(ctx context.Context, billingAccountName string, billingProfileName string, parameters Policy) (*http.Request, error) { pathParameters := map[string]interface{}{ "billingAccountName": autorest.Encode("path", billingAccountName), "billingProfileName": autorest.Encode("path", billingProfileName), @@ -177,14 +177,14 @@ func (client PolicyClient) UpdatePreparer(ctx context.Context, billingAccountNam // UpdateSender sends the Update request. The method will close the // http.Response Body if it receives an error. -func (client PolicyClient) UpdateSender(req *http.Request) (*http.Response, error) { +func (client PoliciesClient) UpdateSender(req *http.Request) (*http.Response, error) { return autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) } // UpdateResponder handles the response to the Update request. The method always // closes the http.Response Body. -func (client PolicyClient) UpdateResponder(resp *http.Response) (result Policy, err error) { +func (client PoliciesClient) UpdateResponder(resp *http.Response) (result Policy, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicepricesheet.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/pricesheet.go similarity index 64% rename from services/preview/billing/mgmt/2018-11-01-preview/billing/invoicepricesheet.go rename to services/preview/billing/mgmt/2018-11-01-preview/billing/pricesheet.go index 7e1facda3db5..6f7f799b8a47 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/invoicepricesheet.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/pricesheet.go @@ -25,28 +25,28 @@ import ( "net/http" ) -// InvoicePricesheetClient is the billing client provides access to billing resources for Azure subscriptions. -type InvoicePricesheetClient struct { +// PriceSheetClient is the billing client provides access to billing resources for Azure subscriptions. +type PriceSheetClient struct { BaseClient } -// NewInvoicePricesheetClient creates an instance of the InvoicePricesheetClient client. -func NewInvoicePricesheetClient(subscriptionID string) InvoicePricesheetClient { - return NewInvoicePricesheetClientWithBaseURI(DefaultBaseURI, subscriptionID) +// NewPriceSheetClient creates an instance of the PriceSheetClient client. +func NewPriceSheetClient(subscriptionID string) PriceSheetClient { + return NewPriceSheetClientWithBaseURI(DefaultBaseURI, subscriptionID) } -// NewInvoicePricesheetClientWithBaseURI creates an instance of the InvoicePricesheetClient client. -func NewInvoicePricesheetClientWithBaseURI(baseURI string, subscriptionID string) InvoicePricesheetClient { - return InvoicePricesheetClient{NewWithBaseURI(baseURI, subscriptionID)} +// NewPriceSheetClientWithBaseURI creates an instance of the PriceSheetClient client. +func NewPriceSheetClientWithBaseURI(baseURI string, subscriptionID string) PriceSheetClient { + return PriceSheetClient{NewWithBaseURI(baseURI, subscriptionID)} } -// Download get pricesheet data for invoice id (invoiceName). +// Download download price sheet for an invoice. // Parameters: // billingAccountName - azure Billing Account ID. // invoiceName - the name of an invoice resource. -func (client InvoicePricesheetClient) Download(ctx context.Context, billingAccountName string, invoiceName string) (result InvoicePricesheetDownloadFuture, err error) { +func (client PriceSheetClient) Download(ctx context.Context, billingAccountName string, invoiceName string) (result PriceSheetDownloadFuture, err error) { if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/InvoicePricesheetClient.Download") + ctx = tracing.StartSpan(ctx, fqdn+"/PriceSheetClient.Download") defer func() { sc := -1 if result.Response() != nil { @@ -57,13 +57,13 @@ func (client InvoicePricesheetClient) Download(ctx context.Context, billingAccou } req, err := client.DownloadPreparer(ctx, billingAccountName, invoiceName) if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicePricesheetClient", "Download", nil, "Failure preparing request") + err = autorest.NewErrorWithError(err, "billing.PriceSheetClient", "Download", nil, "Failure preparing request") return } result, err = client.DownloadSender(req) if err != nil { - err = autorest.NewErrorWithError(err, "billing.InvoicePricesheetClient", "Download", result.Response(), "Failure sending request") + err = autorest.NewErrorWithError(err, "billing.PriceSheetClient", "Download", result.Response(), "Failure sending request") return } @@ -71,7 +71,7 @@ func (client InvoicePricesheetClient) Download(ctx context.Context, billingAccou } // DownloadPreparer prepares the Download request. -func (client InvoicePricesheetClient) DownloadPreparer(ctx context.Context, billingAccountName string, invoiceName string) (*http.Request, error) { +func (client PriceSheetClient) DownloadPreparer(ctx context.Context, billingAccountName string, invoiceName string) (*http.Request, error) { pathParameters := map[string]interface{}{ "billingAccountName": autorest.Encode("path", billingAccountName), "invoiceName": autorest.Encode("path", invoiceName), @@ -92,7 +92,7 @@ func (client InvoicePricesheetClient) DownloadPreparer(ctx context.Context, bill // DownloadSender sends the Download request. The method will close the // http.Response Body if it receives an error. -func (client InvoicePricesheetClient) DownloadSender(req *http.Request) (future InvoicePricesheetDownloadFuture, err error) { +func (client PriceSheetClient) DownloadSender(req *http.Request) (future PriceSheetDownloadFuture, err error) { var resp *http.Response resp, err = autorest.SendWithSender(client, req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) @@ -105,7 +105,7 @@ func (client InvoicePricesheetClient) DownloadSender(req *http.Request) (future // DownloadResponder handles the response to the Download request. The method always // closes the http.Response Body. -func (client InvoicePricesheetClient) DownloadResponder(resp *http.Response) (result DownloadURL, err error) { +func (client PriceSheetClient) DownloadResponder(resp *http.Response) (result DownloadURL, err error) { err = autorest.Respond( resp, client.ByInspecting(), diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go index e6ce2acad1eb..105baa3911d4 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/products.go @@ -118,7 +118,207 @@ func (client ProductsClient) GetResponder(resp *http.Response) (result ProductSu return } -// Transfer the operation to transfer a Product to another InvoiceSection. +// ListByBillingAccountName lists products by billing account name. +// Parameters: +// billingAccountName - billing Account Id. +// filter - may be used to filter by product type. 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 ProductsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, filter string) (result ProductsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.plr.Response.Response != nil { + sc = result.plr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByBillingAccountNameNextResults + req, err := client.ListByBillingAccountNamePreparer(ctx, billingAccountName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ListByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.plr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result.plr, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client ProductsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, filter 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(filter) > 0 { + queryParameters["$filter"] = autorest.Encode("query", filter) + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products", 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 ProductsClient) 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 ProductsClient) ListByBillingAccountNameResponder(resp *http.Response) (result ProductsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBillingAccountNameNextResults retrieves the next set of results, if any. +func (client ProductsClient) listByBillingAccountNameNextResults(ctx context.Context, lastResults ProductsListResult) (result ProductsListResult, err error) { + req, err := lastResults.productsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.ProductsClient", "listByBillingAccountNameNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.ProductsClient", "listByBillingAccountNameNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "listByBillingAccountNameNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBillingAccountNameComplete enumerates all values, automatically crossing page boundaries as required. +func (client ProductsClient) ListByBillingAccountNameComplete(ctx context.Context, billingAccountName string, filter string) (result ProductsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBillingAccountName(ctx, billingAccountName, filter) + return +} + +// ListByInvoiceSectionName lists products by invoice section name. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// filter - may be used to filter by product type. 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 ProductsClient) ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, filter string) (result ProductsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.ListByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ListByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ListByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.ListByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "ListByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// ListByInvoiceSectionNamePreparer prepares the ListByInvoiceSectionName request. +func (client ProductsClient) ListByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, + } + 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}/products", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInvoiceSectionNameSender sends the ListByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) ListByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByInvoiceSectionNameResponder handles the response to the ListByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client ProductsClient) ListByInvoiceSectionNameResponder(resp *http.Response) (result ProductsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Transfer the operation to transfer a Product to another invoice section. // Parameters: // billingAccountName - billing Account Id. // invoiceSectionName - invoiceSection Id. @@ -198,3 +398,163 @@ func (client ProductsClient) TransferResponder(resp *http.Response) (result Prod result.Response = autorest.Response{Response: resp} return } + +// UpdateAutoRenewByBillingAccountName cancel auto renew for product by product id and billing account name +// Parameters: +// billingAccountName - billing Account Id. +// productName - invoice Id. +// body - update auto renew request parameters. +func (client ProductsClient) UpdateAutoRenewByBillingAccountName(ctx context.Context, billingAccountName string, productName string, body UpdateAutoRenewRequest) (result UpdateAutoRenewOperationSummary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.UpdateAutoRenewByBillingAccountName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateAutoRenewByBillingAccountNamePreparer(ctx, billingAccountName, productName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "UpdateAutoRenewByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAutoRenewByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "UpdateAutoRenewByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.UpdateAutoRenewByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "UpdateAutoRenewByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// UpdateAutoRenewByBillingAccountNamePreparer prepares the UpdateAutoRenewByBillingAccountName request. +func (client ProductsClient) UpdateAutoRenewByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, productName string, body UpdateAutoRenewRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "productName": autorest.Encode("path", productName), + } + + const APIVersion = "2018-11-01-preview" + 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.Billing/billingAccounts/{billingAccountName}/products/{productName}/updateAutoRenew", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAutoRenewByBillingAccountNameSender sends the UpdateAutoRenewByBillingAccountName request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) UpdateAutoRenewByBillingAccountNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateAutoRenewByBillingAccountNameResponder handles the response to the UpdateAutoRenewByBillingAccountName request. The method always +// closes the http.Response Body. +func (client ProductsClient) UpdateAutoRenewByBillingAccountNameResponder(resp *http.Response) (result UpdateAutoRenewOperationSummary, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// UpdateAutoRenewByInvoiceSectionName cancel auto renew for product by product id and invoice section name +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// productName - invoice Id. +// body - update auto renew request parameters. +func (client ProductsClient) UpdateAutoRenewByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body UpdateAutoRenewRequest) (result UpdateAutoRenewOperationSummary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProductsClient.UpdateAutoRenewByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.UpdateAutoRenewByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, productName, body) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "UpdateAutoRenewByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.UpdateAutoRenewByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "UpdateAutoRenewByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.UpdateAutoRenewByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProductsClient", "UpdateAutoRenewByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// UpdateAutoRenewByInvoiceSectionNamePreparer prepares the UpdateAutoRenewByInvoiceSectionName request. +func (client ProductsClient) UpdateAutoRenewByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, productName string, body UpdateAutoRenewRequest) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + "productName": autorest.Encode("path", productName), + } + + const APIVersion = "2018-11-01-preview" + 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.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/products/{productName}/updateAutoRenew", pathParameters), + autorest.WithJSON(body), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// UpdateAutoRenewByInvoiceSectionNameSender sends the UpdateAutoRenewByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client ProductsClient) UpdateAutoRenewByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// UpdateAutoRenewByInvoiceSectionNameResponder handles the response to the UpdateAutoRenewByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client ProductsClient) UpdateAutoRenewByInvoiceSectionNameResponder(resp *http.Response) (result UpdateAutoRenewOperationSummary, 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/productsbybillingaccount.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbybillingaccount.go deleted file mode 100644 index 7368cf3ff45f..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbybillingaccount.go +++ /dev/null @@ -1,159 +0,0 @@ -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" -) - -// ProductsByBillingAccountClient is the billing client provides access to billing resources for Azure subscriptions. -type ProductsByBillingAccountClient struct { - BaseClient -} - -// NewProductsByBillingAccountClient creates an instance of the ProductsByBillingAccountClient client. -func NewProductsByBillingAccountClient(subscriptionID string) ProductsByBillingAccountClient { - return NewProductsByBillingAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductsByBillingAccountClientWithBaseURI creates an instance of the ProductsByBillingAccountClient client. -func NewProductsByBillingAccountClientWithBaseURI(baseURI string, subscriptionID string) ProductsByBillingAccountClient { - return ProductsByBillingAccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists products by billingAccountName. -// Parameters: -// billingAccountName - billing Account Id. -// filter - may be used to filter by product type. 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 ProductsByBillingAccountClient) List(ctx context.Context, billingAccountName string, filter string) (result ProductsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductsByBillingAccountClient.List") - defer func() { - sc := -1 - if result.plr.Response.Response != nil { - sc = result.plr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, billingAccountName, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingAccountClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.plr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingAccountClient", "List", resp, "Failure sending request") - return - } - - result.plr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingAccountClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProductsByBillingAccountClient) ListPreparer(ctx context.Context, billingAccountName string, filter 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(filter) > 0 { - queryParameters["$filter"] = autorest.Encode("query", filter) - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/products", 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 ProductsByBillingAccountClient) 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 ProductsByBillingAccountClient) ListResponder(resp *http.Response) (result ProductsListResult, 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 ProductsByBillingAccountClient) listNextResults(ctx context.Context, lastResults ProductsListResult) (result ProductsListResult, err error) { - req, err := lastResults.productsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.ProductsByBillingAccountClient", "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, "billing.ProductsByBillingAccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingAccountClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductsByBillingAccountClient) ListComplete(ctx context.Context, billingAccountName string, filter string) (result ProductsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductsByBillingAccountClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, billingAccountName, filter) - return -} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbybillingsubscriptions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbybillingsubscriptions.go deleted file mode 100644 index fc795fd359ae..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbybillingsubscriptions.go +++ /dev/null @@ -1,155 +0,0 @@ -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" -) - -// ProductsByBillingSubscriptionsClient is the billing client provides access to billing resources for Azure -// subscriptions. -type ProductsByBillingSubscriptionsClient struct { - BaseClient -} - -// NewProductsByBillingSubscriptionsClient creates an instance of the ProductsByBillingSubscriptionsClient client. -func NewProductsByBillingSubscriptionsClient(subscriptionID string) ProductsByBillingSubscriptionsClient { - return NewProductsByBillingSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductsByBillingSubscriptionsClientWithBaseURI creates an instance of the ProductsByBillingSubscriptionsClient -// client. -func NewProductsByBillingSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) ProductsByBillingSubscriptionsClient { - return ProductsByBillingSubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists billing subscriptions by billingAccountName. -// Parameters: -// billingAccountName - billing Account Id. -func (client ProductsByBillingSubscriptionsClient) List(ctx context.Context, billingAccountName string) (result SubscriptionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductsByBillingSubscriptionsClient.List") - defer func() { - sc := -1 - if result.slr.Response.Response != nil { - sc = result.slr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, billingAccountName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingSubscriptionsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.slr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingSubscriptionsClient", "List", resp, "Failure sending request") - return - } - - result.slr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingSubscriptionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProductsByBillingSubscriptionsClient) ListPreparer(ctx context.Context, billingAccountName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions", 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 ProductsByBillingSubscriptionsClient) 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 ProductsByBillingSubscriptionsClient) ListResponder(resp *http.Response) (result SubscriptionsListResult, 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 ProductsByBillingSubscriptionsClient) listNextResults(ctx context.Context, lastResults SubscriptionsListResult) (result SubscriptionsListResult, err error) { - req, err := lastResults.subscriptionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.ProductsByBillingSubscriptionsClient", "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, "billing.ProductsByBillingSubscriptionsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByBillingSubscriptionsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client ProductsByBillingSubscriptionsClient) ListComplete(ctx context.Context, billingAccountName string) (result SubscriptionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductsByBillingSubscriptionsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, billingAccountName) - return -} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbyinvoicesection.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbyinvoicesection.go deleted file mode 100644 index 95bc8c2f161f..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/productsbyinvoicesection.go +++ /dev/null @@ -1,123 +0,0 @@ -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" -) - -// ProductsByInvoiceSectionClient is the billing client provides access to billing resources for Azure subscriptions. -type ProductsByInvoiceSectionClient struct { - BaseClient -} - -// NewProductsByInvoiceSectionClient creates an instance of the ProductsByInvoiceSectionClient client. -func NewProductsByInvoiceSectionClient(subscriptionID string) ProductsByInvoiceSectionClient { - return NewProductsByInvoiceSectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProductsByInvoiceSectionClientWithBaseURI creates an instance of the ProductsByInvoiceSectionClient client. -func NewProductsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) ProductsByInvoiceSectionClient { - return ProductsByInvoiceSectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists products by invoiceSectionName. -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// filter - may be used to filter by product type. 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 ProductsByInvoiceSectionClient) List(ctx context.Context, billingAccountName string, invoiceSectionName string, filter string) (result ProductsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProductsByInvoiceSectionClient.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, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByInvoiceSectionClient", "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.ProductsByInvoiceSectionClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProductsByInvoiceSectionClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProductsByInvoiceSectionClient) ListPreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, - } - 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}/products", 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 ProductsByInvoiceSectionClient) 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 ProductsByInvoiceSectionClient) ListResponder(resp *http.Response) (result ProductsListResult, 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/profilebillingpermissions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/profilebillingpermissions.go deleted file mode 100644 index 74daa475bbbc..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/profilebillingpermissions.go +++ /dev/null @@ -1,117 +0,0 @@ -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" -) - -// ProfileBillingPermissionsClient is the billing client provides access to billing resources for Azure subscriptions. -type ProfileBillingPermissionsClient struct { - BaseClient -} - -// NewProfileBillingPermissionsClient creates an instance of the ProfileBillingPermissionsClient client. -func NewProfileBillingPermissionsClient(subscriptionID string) ProfileBillingPermissionsClient { - return NewProfileBillingPermissionsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfileBillingPermissionsClientWithBaseURI creates an instance of the ProfileBillingPermissionsClient client. -func NewProfileBillingPermissionsClientWithBaseURI(baseURI string, subscriptionID string) ProfileBillingPermissionsClient { - return ProfileBillingPermissionsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all billingPermissions for the caller has for a billing account. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -func (client ProfileBillingPermissionsClient) List(ctx context.Context, billingAccountName string, billingProfileName string) (result PermissionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingPermissionsClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingPermissionsClient", "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.ProfileBillingPermissionsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingPermissionsClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProfileBillingPermissionsClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingPermissions", 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 ProfileBillingPermissionsClient) 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 ProfileBillingPermissionsClient) ListResponder(resp *http.Response) (result PermissionsListResult, 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/profilebillingroleassignment.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/profilebillingroleassignment.go deleted file mode 100644 index 37f6e2132dc6..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/profilebillingroleassignment.go +++ /dev/null @@ -1,354 +0,0 @@ -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" -) - -// ProfileBillingRoleAssignmentClient is the billing client provides access to billing resources for Azure -// subscriptions. -type ProfileBillingRoleAssignmentClient struct { - BaseClient -} - -// NewProfileBillingRoleAssignmentClient creates an instance of the ProfileBillingRoleAssignmentClient client. -func NewProfileBillingRoleAssignmentClient(subscriptionID string) ProfileBillingRoleAssignmentClient { - return NewProfileBillingRoleAssignmentClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfileBillingRoleAssignmentClientWithBaseURI creates an instance of the ProfileBillingRoleAssignmentClient -// client. -func NewProfileBillingRoleAssignmentClientWithBaseURI(baseURI string, subscriptionID string) ProfileBillingRoleAssignmentClient { - return ProfileBillingRoleAssignmentClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Add the operation to add a role assignment to a billing profile. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// parameters - parameters supplied to add a role assignment. -func (client ProfileBillingRoleAssignmentClient) Add(ctx context.Context, billingAccountName string, billingProfileName string, parameters RoleAssignmentPayload) (result RoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingRoleAssignmentClient.Add") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.AddPreparer(ctx, billingAccountName, billingProfileName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Add", nil, "Failure preparing request") - return - } - - resp, err := client.AddSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Add", resp, "Failure sending request") - return - } - - result, err = client.AddResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Add", resp, "Failure responding to request") - } - - return -} - -// AddPreparer prepares the Add request. -func (client ProfileBillingRoleAssignmentClient) AddPreparer(ctx context.Context, billingAccountName string, billingProfileName string, parameters RoleAssignmentPayload) (*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, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment", pathParameters), - autorest.WithJSON(parameters), - 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 ProfileBillingRoleAssignmentClient) 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 ProfileBillingRoleAssignmentClient) AddResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the role assignment on this Billing Profile -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// billingRoleAssignmentName - role assignment id. -func (client ProfileBillingRoleAssignmentClient) Delete(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingRoleAssignmentClient.Delete") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.DeletePreparer(ctx, billingAccountName, billingProfileName, billingRoleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Delete", nil, "Failure preparing request") - return - } - - resp, err := client.DeleteSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Delete", resp, "Failure sending request") - return - } - - result, err = client.DeleteResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Delete", resp, "Failure responding to request") - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client ProfileBillingRoleAssignmentClient) DeletePreparer(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingProfileName": autorest.Encode("path", billingProfileName), - "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", 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 ProfileBillingRoleAssignmentClient) 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 ProfileBillingRoleAssignmentClient) DeleteResponder(resp *http.Response) (result RoleAssignment, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Get get the role assignment for the caller on the Billing Profile -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// billingRoleAssignmentName - role assignment id. -func (client ProfileBillingRoleAssignmentClient) Get(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingRoleAssignmentClient.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, billingProfileName, billingRoleAssignmentName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "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.ProfileBillingRoleAssignmentClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProfileBillingRoleAssignmentClient) GetPreparer(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingProfileName": autorest.Encode("path", billingProfileName), - "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", 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 ProfileBillingRoleAssignmentClient) 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 ProfileBillingRoleAssignmentClient) GetResponder(resp *http.Response) (result RoleAssignment, 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 get the role assignments on the Billing Profile -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -func (client ProfileBillingRoleAssignmentClient) List(ctx context.Context, billingAccountName string, billingProfileName string) (result RoleAssignmentListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingRoleAssignmentClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "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.ProfileBillingRoleAssignmentClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleAssignmentClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProfileBillingRoleAssignmentClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments", 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 ProfileBillingRoleAssignmentClient) 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 ProfileBillingRoleAssignmentClient) ListResponder(resp *http.Response) (result RoleAssignmentListResult, 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/profilebillingroledefinition.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/profilebillingroledefinition.go deleted file mode 100644 index 285f904a6675..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/profilebillingroledefinition.go +++ /dev/null @@ -1,197 +0,0 @@ -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" -) - -// ProfileBillingRoleDefinitionClient is the billing client provides access to billing resources for Azure -// subscriptions. -type ProfileBillingRoleDefinitionClient struct { - BaseClient -} - -// NewProfileBillingRoleDefinitionClient creates an instance of the ProfileBillingRoleDefinitionClient client. -func NewProfileBillingRoleDefinitionClient(subscriptionID string) ProfileBillingRoleDefinitionClient { - return NewProfileBillingRoleDefinitionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfileBillingRoleDefinitionClientWithBaseURI creates an instance of the ProfileBillingRoleDefinitionClient -// client. -func NewProfileBillingRoleDefinitionClientWithBaseURI(baseURI string, subscriptionID string) ProfileBillingRoleDefinitionClient { - return ProfileBillingRoleDefinitionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get gets the role definition for a role -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -// billingRoleDefinitionName - role definition id. -func (client ProfileBillingRoleDefinitionClient) Get(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleDefinitionName string) (result RoleDefinition, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingRoleDefinitionClient.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, billingProfileName, billingRoleDefinitionName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleDefinitionClient", "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.ProfileBillingRoleDefinitionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleDefinitionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client ProfileBillingRoleDefinitionClient) GetPreparer(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleDefinitionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingProfileName": autorest.Encode("path", billingProfileName), - "billingRoleDefinitionName": autorest.Encode("path", billingRoleDefinitionName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}", 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 ProfileBillingRoleDefinitionClient) 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 ProfileBillingRoleDefinitionClient) GetResponder(resp *http.Response) (result RoleDefinition, 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 lists the role definition for a Billing Profile -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -func (client ProfileBillingRoleDefinitionClient) List(ctx context.Context, billingAccountName string, billingProfileName string) (result RoleDefinitionListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfileBillingRoleDefinitionClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleDefinitionClient", "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.ProfileBillingRoleDefinitionClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfileBillingRoleDefinitionClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProfileBillingRoleDefinitionClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions", 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 ProfileBillingRoleDefinitionClient) 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 ProfileBillingRoleDefinitionClient) ListResponder(resp *http.Response) (result RoleDefinitionListResult, 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/profiles.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go index 2ef1d81373f8..9a1816f2ede7 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/profiles.go @@ -120,6 +120,84 @@ func (client ProfilesClient) GetResponder(resp *http.Response) (result Profile, return } +// ListByBillingAccountName lists all billing profiles for a user which that user has access to. +// Parameters: +// billingAccountName - billing Account Id. +// expand - may be used to expand the invoiceSections. +func (client ProfilesClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, expand string) (result ProfileListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesClient.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.ProfilesClient", "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.ProfilesClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.ProfilesClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client ProfilesClient) 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}/billingProfiles", 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 ProfilesClient) 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 ProfilesClient) ListByBillingAccountNameResponder(resp *http.Response) (result ProfileListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + // Update the operation to update a billing profile. // Parameters: // billingAccountName - billing Account Id. diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/profilesbybillingaccountname.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/profilesbybillingaccountname.go deleted file mode 100644 index 63e58edfe54d..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/profilesbybillingaccountname.go +++ /dev/null @@ -1,121 +0,0 @@ -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" -) - -// ProfilesByBillingAccountNameClient is the billing client provides access to billing resources for Azure -// subscriptions. -type ProfilesByBillingAccountNameClient struct { - BaseClient -} - -// NewProfilesByBillingAccountNameClient creates an instance of the ProfilesByBillingAccountNameClient client. -func NewProfilesByBillingAccountNameClient(subscriptionID string) ProfilesByBillingAccountNameClient { - return NewProfilesByBillingAccountNameClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewProfilesByBillingAccountNameClientWithBaseURI creates an instance of the ProfilesByBillingAccountNameClient -// client. -func NewProfilesByBillingAccountNameClientWithBaseURI(baseURI string, subscriptionID string) ProfilesByBillingAccountNameClient { - return ProfilesByBillingAccountNameClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all billing profiles for a user which that user has access to. -// Parameters: -// billingAccountName - billing Account Id. -// expand - may be used to expand the invoiceSections. -func (client ProfilesByBillingAccountNameClient) List(ctx context.Context, billingAccountName string, expand string) (result ProfileListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ProfilesByBillingAccountNameClient.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, expand) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfilesByBillingAccountNameClient", "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.ProfilesByBillingAccountNameClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.ProfilesByBillingAccountNameClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client ProfilesByBillingAccountNameClient) ListPreparer(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}/billingProfiles", 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 ProfilesByBillingAccountNameClient) 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 ProfilesByBillingAccountNameClient) ListResponder(resp *http.Response) (result ProfileListResult, 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/roleassignments.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/roleassignments.go new file mode 100644 index 000000000000..a36a28825a23 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/roleassignments.go @@ -0,0 +1,972 @@ +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" +) + +// RoleAssignmentsClient is the billing client provides access to billing resources for Azure subscriptions. +type RoleAssignmentsClient struct { + BaseClient +} + +// NewRoleAssignmentsClient creates an instance of the RoleAssignmentsClient client. +func NewRoleAssignmentsClient(subscriptionID string) RoleAssignmentsClient { + return NewRoleAssignmentsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleAssignmentsClientWithBaseURI creates an instance of the RoleAssignmentsClient client. +func NewRoleAssignmentsClientWithBaseURI(baseURI string, subscriptionID string) RoleAssignmentsClient { + return RoleAssignmentsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// AddByBillingAccountName the operation to add a role assignment to a billing account. +// Parameters: +// billingAccountName - billing Account Id. +// parameters - parameters supplied to add a role assignment. +func (client RoleAssignmentsClient) AddByBillingAccountName(ctx context.Context, billingAccountName string, parameters RoleAssignmentPayload) (result RoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.AddByBillingAccountName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddByBillingAccountNamePreparer(ctx, billingAccountName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.AddByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.AddByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// AddByBillingAccountNamePreparer prepares the AddByBillingAccountName request. +func (client RoleAssignmentsClient) AddByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, parameters RoleAssignmentPayload) (*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, + } + + parameters.PrincipalID = nil + parameters.BillingRoleDefinitionName = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/createBillingRoleAssignment", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddByBillingAccountNameSender sends the AddByBillingAccountName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) AddByBillingAccountNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddByBillingAccountNameResponder handles the response to the AddByBillingAccountName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) AddByBillingAccountNameResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddByBillingProfileName the operation to add a role assignment to a billing profile. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// parameters - parameters supplied to add a role assignment. +func (client RoleAssignmentsClient) AddByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, parameters RoleAssignmentPayload) (result RoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.AddByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.AddByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.AddByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// AddByBillingProfileNamePreparer prepares the AddByBillingProfileName request. +func (client RoleAssignmentsClient) AddByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName string, parameters RoleAssignmentPayload) (*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, + } + + parameters.PrincipalID = nil + parameters.BillingRoleDefinitionName = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/createBillingRoleAssignment", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddByBillingProfileNameSender sends the AddByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) AddByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddByBillingProfileNameResponder handles the response to the AddByBillingProfileName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) AddByBillingProfileNameResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// AddByInvoiceSectionName the operation to add a role assignment to a invoice Section. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// parameters - parameters supplied to add a role assignment. +func (client RoleAssignmentsClient) AddByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters RoleAssignmentPayload) (result RoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.AddByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.AddByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.AddByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.AddByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "AddByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// AddByInvoiceSectionNamePreparer prepares the AddByInvoiceSectionName request. +func (client RoleAssignmentsClient) AddByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, parameters RoleAssignmentPayload) (*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, + } + + parameters.PrincipalID = nil + parameters.BillingRoleDefinitionName = nil + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/createBillingRoleAssignment", pathParameters), + autorest.WithJSON(parameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// AddByInvoiceSectionNameSender sends the AddByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) AddByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// AddByInvoiceSectionNameResponder handles the response to the AddByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) AddByInvoiceSectionNameResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByBillingAccountName delete the role assignment on this billing account +// Parameters: +// billingAccountName - billing Account Id. +// billingRoleAssignmentName - role assignment id. +func (client RoleAssignmentsClient) DeleteByBillingAccountName(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.DeleteByBillingAccountName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteByBillingAccountNamePreparer(ctx, billingAccountName, billingRoleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.DeleteByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// DeleteByBillingAccountNamePreparer prepares the DeleteByBillingAccountName request. +func (client RoleAssignmentsClient) DeleteByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteByBillingAccountNameSender sends the DeleteByBillingAccountName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteByBillingAccountNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteByBillingAccountNameResponder handles the response to the DeleteByBillingAccountName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteByBillingAccountNameResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByBillingProfileName delete the role assignment on this Billing Profile +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// billingRoleAssignmentName - role assignment id. +func (client RoleAssignmentsClient) DeleteByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.DeleteByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName, billingRoleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.DeleteByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// DeleteByBillingProfileNamePreparer prepares the DeleteByBillingProfileName request. +func (client RoleAssignmentsClient) DeleteByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingProfileName": autorest.Encode("path", billingProfileName), + "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteByBillingProfileNameSender sends the DeleteByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteByBillingProfileNameResponder handles the response to the DeleteByBillingProfileName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteByBillingProfileNameResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// DeleteByInvoiceSectionName delete the role assignment on the invoice Section +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// billingRoleAssignmentName - role assignment id. +func (client RoleAssignmentsClient) DeleteByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.DeleteByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.DeleteByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, billingRoleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.DeleteByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.DeleteByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "DeleteByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// DeleteByInvoiceSectionNamePreparer prepares the DeleteByInvoiceSectionName request. +func (client RoleAssignmentsClient) DeleteByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsDelete(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// DeleteByInvoiceSectionNameSender sends the DeleteByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) DeleteByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// DeleteByInvoiceSectionNameResponder handles the response to the DeleteByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) DeleteByInvoiceSectionNameResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByBillingAccount get the role assignment for the caller +// Parameters: +// billingAccountName - billing Account Id. +// billingRoleAssignmentName - role assignment id. +func (client RoleAssignmentsClient) GetByBillingAccount(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.GetByBillingAccount") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByBillingAccountPreparer(ctx, billingAccountName, billingRoleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByBillingAccount", nil, "Failure preparing request") + return + } + + resp, err := client.GetByBillingAccountSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByBillingAccount", resp, "Failure sending request") + return + } + + result, err = client.GetByBillingAccountResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByBillingAccount", resp, "Failure responding to request") + } + + return +} + +// GetByBillingAccountPreparer prepares the GetByBillingAccount request. +func (client RoleAssignmentsClient) GetByBillingAccountPreparer(ctx context.Context, billingAccountName string, billingRoleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByBillingAccountSender sends the GetByBillingAccount request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetByBillingAccountSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByBillingAccountResponder handles the response to the GetByBillingAccount request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetByBillingAccountResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByBillingProfileName get the role assignment for the caller on the Billing Profile +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// billingRoleAssignmentName - role assignment id. +func (client RoleAssignmentsClient) GetByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.GetByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName, billingRoleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.GetByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// GetByBillingProfileNamePreparer prepares the GetByBillingProfileName request. +func (client RoleAssignmentsClient) GetByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingProfileName": autorest.Encode("path", billingProfileName), + "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByBillingProfileNameSender sends the GetByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByBillingProfileNameResponder handles the response to the GetByBillingProfileName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetByBillingProfileNameResponder(resp *http.Response) (result RoleAssignment, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByInvoiceSectionName get the role assignment for the caller on the invoice Section +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// billingRoleAssignmentName - role assignment id. +func (client RoleAssignmentsClient) GetByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (result RoleAssignment, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.GetByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, billingRoleAssignmentName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.GetByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "GetByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// GetByInvoiceSectionNamePreparer prepares the GetByInvoiceSectionName request. +func (client RoleAssignmentsClient) GetByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleAssignmentName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingRoleAssignmentName": autorest.Encode("path", billingRoleAssignmentName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments/{billingRoleAssignmentName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByInvoiceSectionNameSender sends the GetByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) GetByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByInvoiceSectionNameResponder handles the response to the GetByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) GetByInvoiceSectionNameResponder(resp *http.Response) (result RoleAssignment, 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 get the role assignments on the Billing Account +// Parameters: +// billingAccountName - billing Account Id. +func (client RoleAssignmentsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string) (result RoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.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) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "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.RoleAssignmentsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client RoleAssignmentsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleAssignments", 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 RoleAssignmentsClient) 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 RoleAssignmentsClient) ListByBillingAccountNameResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBillingProfileName get the role assignments on the Billing Profile +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +func (client RoleAssignmentsClient) ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result RoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfileNamePreparer prepares the ListByBillingProfileName request. +func (client RoleAssignmentsClient) ListByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileNameSender sends the ListByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileNameResponder handles the response to the ListByBillingProfileName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListByBillingProfileNameResponder(resp *http.Response) (result RoleAssignmentListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInvoiceSectionName get the role assignments on the invoice Section +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +func (client RoleAssignmentsClient) ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result RoleAssignmentListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleAssignmentsClient.ListByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.ListByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleAssignmentsClient", "ListByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// ListByInvoiceSectionNamePreparer prepares the ListByInvoiceSectionName request. +func (client RoleAssignmentsClient) ListByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleAssignments", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInvoiceSectionNameSender sends the ListByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleAssignmentsClient) ListByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByInvoiceSectionNameResponder handles the response to the ListByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client RoleAssignmentsClient) ListByInvoiceSectionNameResponder(resp *http.Response) (result RoleAssignmentListResult, 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/roledefinitions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/roledefinitions.go new file mode 100644 index 000000000000..e6c25269d73f --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/roledefinitions.go @@ -0,0 +1,499 @@ +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" +) + +// RoleDefinitionsClient is the billing client provides access to billing resources for Azure subscriptions. +type RoleDefinitionsClient struct { + BaseClient +} + +// NewRoleDefinitionsClient creates an instance of the RoleDefinitionsClient client. +func NewRoleDefinitionsClient(subscriptionID string) RoleDefinitionsClient { + return NewRoleDefinitionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewRoleDefinitionsClientWithBaseURI creates an instance of the RoleDefinitionsClient client. +func NewRoleDefinitionsClientWithBaseURI(baseURI string, subscriptionID string) RoleDefinitionsClient { + return RoleDefinitionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// GetByBillingAccountName gets the role definition for a role +// Parameters: +// billingAccountName - billing Account Id. +// billingRoleDefinitionName - role definition id. +func (client RoleDefinitionsClient) GetByBillingAccountName(ctx context.Context, billingAccountName string, billingRoleDefinitionName string) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.GetByBillingAccountName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByBillingAccountNamePreparer(ctx, billingAccountName, billingRoleDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.GetByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// GetByBillingAccountNamePreparer prepares the GetByBillingAccountName request. +func (client RoleDefinitionsClient) GetByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, billingRoleDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingRoleDefinitionName": autorest.Encode("path", billingRoleDefinitionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByBillingAccountNameSender sends the GetByBillingAccountName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) GetByBillingAccountNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByBillingAccountNameResponder handles the response to the GetByBillingAccountName request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetByBillingAccountNameResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByBillingProfileName gets the role definition for a role +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +// billingRoleDefinitionName - role definition id. +func (client RoleDefinitionsClient) GetByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleDefinitionName string) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.GetByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName, billingRoleDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.GetByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// GetByBillingProfileNamePreparer prepares the GetByBillingProfileName request. +func (client RoleDefinitionsClient) GetByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName string, billingRoleDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingProfileName": autorest.Encode("path", billingProfileName), + "billingRoleDefinitionName": autorest.Encode("path", billingRoleDefinitionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByBillingProfileNameSender sends the GetByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) GetByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByBillingProfileNameResponder handles the response to the GetByBillingProfileName request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetByBillingProfileNameResponder(resp *http.Response) (result RoleDefinition, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// GetByInvoiceSectionName gets the role definition for a role +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// billingRoleDefinitionName - role definition id. +func (client RoleDefinitionsClient) GetByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleDefinitionName string) (result RoleDefinition, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.GetByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.GetByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, billingRoleDefinitionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.GetByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.GetByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "GetByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// GetByInvoiceSectionNamePreparer prepares the GetByInvoiceSectionName request. +func (client RoleDefinitionsClient) GetByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingRoleDefinitionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingRoleDefinitionName": autorest.Encode("path", billingRoleDefinitionName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions/{billingRoleDefinitionName}", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// GetByInvoiceSectionNameSender sends the GetByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) GetByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// GetByInvoiceSectionNameResponder handles the response to the GetByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) GetByInvoiceSectionNameResponder(resp *http.Response) (result RoleDefinition, 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 the role definition for a billing account +// Parameters: +// billingAccountName - billing Account Id. +func (client RoleDefinitionsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string) (result RoleDefinitionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.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) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "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.RoleDefinitionsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client RoleDefinitionsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/providers/Microsoft.Billing/billingRoleDefinitions", 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 RoleDefinitionsClient) 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 RoleDefinitionsClient) ListByBillingAccountNameResponder(resp *http.Response) (result RoleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByBillingProfileName lists the role definition for a Billing Profile +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +func (client RoleDefinitionsClient) ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result RoleDefinitionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfileNamePreparer prepares the ListByBillingProfileName request. +func (client RoleDefinitionsClient) ListByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/providers/Microsoft.Billing/billingRoleDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileNameSender sends the ListByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) ListByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileNameResponder handles the response to the ListByBillingProfileName request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) ListByBillingProfileNameResponder(resp *http.Response) (result RoleDefinitionListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInvoiceSectionName lists the role definition for an invoice Section +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +func (client RoleDefinitionsClient) ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result RoleDefinitionListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RoleDefinitionsClient.ListByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.ListByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.RoleDefinitionsClient", "ListByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// ListByInvoiceSectionNamePreparer prepares the ListByInvoiceSectionName request. +func (client RoleDefinitionsClient) ListByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Billing/billingRoleDefinitions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInvoiceSectionNameSender sends the ListByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client RoleDefinitionsClient) ListByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByInvoiceSectionNameResponder handles the response to the ListByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client RoleDefinitionsClient) ListByInvoiceSectionNameResponder(resp *http.Response) (result RoleDefinitionListResult, 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/subscription.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscription.go deleted file mode 100644 index 325d54ef7918..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscription.go +++ /dev/null @@ -1,194 +0,0 @@ -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" -) - -// SubscriptionClient is the billing client provides access to billing resources for Azure subscriptions. -type SubscriptionClient struct { - BaseClient -} - -// NewSubscriptionClient creates an instance of the SubscriptionClient client. -func NewSubscriptionClient(subscriptionID string) SubscriptionClient { - return NewSubscriptionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionClientWithBaseURI creates an instance of the SubscriptionClient client. -func NewSubscriptionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionClient { - return SubscriptionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get a single billing subscription by name. -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// billingSubscriptionName - billing Subscription Id. -func (client SubscriptionClient) Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string) (result SubscriptionSummary, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.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, invoiceSectionName, billingSubscriptionName) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionClient", "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.SubscriptionClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionClient", "Get", resp, "Failure responding to request") - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubscriptionClient) GetPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingSubscriptionName": autorest.Encode("path", billingSubscriptionName), - "invoiceSectionName": autorest.Encode("path", invoiceSectionName), - } - - const APIVersion = "2018-11-01-preview" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}", 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 SubscriptionClient) 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 SubscriptionClient) GetResponder(resp *http.Response) (result SubscriptionSummary, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Transfer transfers the GTM subscription from one invoice section to another within a billing account. -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -// billingSubscriptionName - billing Subscription Id. -// parameters - parameters supplied to the Transfer Billing Subscription operation. -func (client SubscriptionClient) Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters TransferBillingSubscriptionRequestProperties) (result SubscriptionTransferFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionClient.Transfer") - defer func() { - sc := -1 - if result.Response() != nil { - sc = result.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.TransferPreparer(ctx, billingAccountName, invoiceSectionName, billingSubscriptionName, parameters) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionClient", "Transfer", nil, "Failure preparing request") - return - } - - result, err = client.TransferSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionClient", "Transfer", result.Response(), "Failure sending request") - return - } - - return -} - -// TransferPreparer prepares the Transfer request. -func (client SubscriptionClient) TransferPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters TransferBillingSubscriptionRequestProperties) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "billingAccountName": autorest.Encode("path", billingAccountName), - "billingSubscriptionName": autorest.Encode("path", billingSubscriptionName), - "invoiceSectionName": autorest.Encode("path", invoiceSectionName), - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPost(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer", pathParameters), - autorest.WithJSON(parameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// TransferSender sends the Transfer request. The method will close the -// http.Response Body if it receives an error. -func (client SubscriptionClient) TransferSender(req *http.Request) (future SubscriptionTransferFuture, err error) { - var resp *http.Response - resp, err = autorest.SendWithSender(client, req, - autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if err != nil { - return - } - future.Future, err = azure.NewFutureFromResponse(resp) - return -} - -// TransferResponder handles the response to the Transfer request. The method always -// closes the http.Response Body. -func (client SubscriptionClient) TransferResponder(resp *http.Response) (result TransferBillingSubscriptionResult, err error) { - err = autorest.Respond( - resp, - client.ByInspecting(), - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go new file mode 100644 index 000000000000..f07d50706cd4 --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptions.go @@ -0,0 +1,458 @@ +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" +) + +// SubscriptionsClient is the billing client provides access to billing resources for Azure subscriptions. +type SubscriptionsClient struct { + BaseClient +} + +// NewSubscriptionsClient creates an instance of the SubscriptionsClient client. +func NewSubscriptionsClient(subscriptionID string) SubscriptionsClient { + return NewSubscriptionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewSubscriptionsClientWithBaseURI creates an instance of the SubscriptionsClient client. +func NewSubscriptionsClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsClient { + return SubscriptionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// Get get a single billing subscription by name. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// billingSubscriptionName - billing Subscription Id. +func (client SubscriptionsClient) Get(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string) (result SubscriptionSummary, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.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, invoiceSectionName, billingSubscriptionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "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.SubscriptionsClient", "Get", resp, "Failure sending request") + return + } + + result, err = client.GetResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "Get", resp, "Failure responding to request") + } + + return +} + +// GetPreparer prepares the Get request. +func (client SubscriptionsClient) GetPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingSubscriptionName": autorest.Encode("path", billingSubscriptionName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + const APIVersion = "2018-11-01-preview" + queryParameters := map[string]interface{}{ + "api-version": APIVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}", 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 SubscriptionsClient) 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 SubscriptionsClient) GetResponder(resp *http.Response) (result SubscriptionSummary, 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 billing subscriptions by billing account name. +// Parameters: +// billingAccountName - billing Account Id. +func (client SubscriptionsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string) (result SubscriptionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.slr.Response.Response != nil { + sc = result.slr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByBillingAccountNameNextResults + req, err := client.ListByBillingAccountNamePreparer(ctx, billingAccountName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.slr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result.slr, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client SubscriptionsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingSubscriptions", 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 SubscriptionsClient) 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 SubscriptionsClient) ListByBillingAccountNameResponder(resp *http.Response) (result SubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// listByBillingAccountNameNextResults retrieves the next set of results, if any. +func (client SubscriptionsClient) listByBillingAccountNameNextResults(ctx context.Context, lastResults SubscriptionsListResult) (result SubscriptionsListResult, err error) { + req, err := lastResults.subscriptionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "listByBillingAccountNameNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "listByBillingAccountNameNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "listByBillingAccountNameNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBillingAccountNameComplete enumerates all values, automatically crossing page boundaries as required. +func (client SubscriptionsClient) ListByBillingAccountNameComplete(ctx context.Context, billingAccountName string) (result SubscriptionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBillingAccountName(ctx, billingAccountName) + return +} + +// ListByBillingProfileName lists billing subscriptions by billing profile name. +// Parameters: +// billingAccountName - billing Account Id. +// billingProfileName - billing Profile Id. +func (client SubscriptionsClient) ListByBillingProfileName(ctx context.Context, billingAccountName string, billingProfileName string) (result SubscriptionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfileNamePreparer prepares the ListByBillingProfileName request. +func (client SubscriptionsClient) ListByBillingProfileNamePreparer(ctx context.Context, billingAccountName string, billingProfileName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByBillingProfileNameSender sends the ListByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileNameResponder handles the response to the ListByBillingProfileName request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListByBillingProfileNameResponder(resp *http.Response) (result SubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// ListByInvoiceSectionName lists billing subscription by invoice section name. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +func (client SubscriptionsClient) ListByInvoiceSectionName(ctx context.Context, billingAccountName string, invoiceSectionName string) (result SubscriptionsListResult, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.ListByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.ListByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "ListByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// ListByInvoiceSectionNamePreparer prepares the ListByInvoiceSectionName request. +func (client SubscriptionsClient) ListByInvoiceSectionNamePreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, + } + + preparer := autorest.CreatePreparer( + autorest.AsGet(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions", pathParameters), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// ListByInvoiceSectionNameSender sends the ListByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) ListByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByInvoiceSectionNameResponder handles the response to the ListByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) ListByInvoiceSectionNameResponder(resp *http.Response) (result SubscriptionsListResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} + +// Transfer transfers the subscription from one invoice section to another within a billing account. +// Parameters: +// billingAccountName - billing Account Id. +// invoiceSectionName - invoiceSection Id. +// billingSubscriptionName - billing Subscription Id. +// parameters - parameters supplied to the Transfer Billing Subscription operation. +func (client SubscriptionsClient) Transfer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters TransferBillingSubscriptionRequestProperties) (result SubscriptionsTransferFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsClient.Transfer") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.TransferPreparer(ctx, billingAccountName, invoiceSectionName, billingSubscriptionName, parameters) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "Transfer", nil, "Failure preparing request") + return + } + + result, err = client.TransferSender(req) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.SubscriptionsClient", "Transfer", result.Response(), "Failure sending request") + return + } + + return +} + +// TransferPreparer prepares the Transfer request. +func (client SubscriptionsClient) TransferPreparer(ctx context.Context, billingAccountName string, invoiceSectionName string, billingSubscriptionName string, parameters TransferBillingSubscriptionRequestProperties) (*http.Request, error) { + pathParameters := map[string]interface{}{ + "billingAccountName": autorest.Encode("path", billingAccountName), + "billingSubscriptionName": autorest.Encode("path", billingSubscriptionName), + "invoiceSectionName": autorest.Encode("path", invoiceSectionName), + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(client.BaseURI), + autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions/{billingSubscriptionName}/transfer", pathParameters), + autorest.WithJSON(parameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// TransferSender sends the Transfer request. The method will close the +// http.Response Body if it receives an error. +func (client SubscriptionsClient) TransferSender(req *http.Request) (future SubscriptionsTransferFuture, err error) { + var resp *http.Response + resp, err = autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) + if err != nil { + return + } + future.Future, err = azure.NewFutureFromResponse(resp) + return +} + +// TransferResponder handles the response to the Transfer request. The method always +// closes the http.Response Body. +func (client SubscriptionsClient) TransferResponder(resp *http.Response) (result TransferBillingSubscriptionResult, err error) { + err = autorest.Respond( + resp, + client.ByInspecting(), + azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), + autorest.ByUnmarshallingJSON(&result), + autorest.ByClosing()) + result.Response = autorest.Response{Response: resp} + return +} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptionsbybillingprofile.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptionsbybillingprofile.go deleted file mode 100644 index c484830e2cdf..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptionsbybillingprofile.go +++ /dev/null @@ -1,119 +0,0 @@ -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" -) - -// SubscriptionsByBillingProfileClient is the billing client provides access to billing resources for Azure -// subscriptions. -type SubscriptionsByBillingProfileClient struct { - BaseClient -} - -// NewSubscriptionsByBillingProfileClient creates an instance of the SubscriptionsByBillingProfileClient client. -func NewSubscriptionsByBillingProfileClient(subscriptionID string) SubscriptionsByBillingProfileClient { - return NewSubscriptionsByBillingProfileClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionsByBillingProfileClientWithBaseURI creates an instance of the SubscriptionsByBillingProfileClient -// client. -func NewSubscriptionsByBillingProfileClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsByBillingProfileClient { - return SubscriptionsByBillingProfileClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists billing subscriptions by billingProfileName. -// Parameters: -// billingAccountName - billing Account Id. -// billingProfileName - billing Profile Id. -func (client SubscriptionsByBillingProfileClient) List(ctx context.Context, billingAccountName string, billingProfileName string) (result SubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsByBillingProfileClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionsByBillingProfileClient", "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.SubscriptionsByBillingProfileClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionsByBillingProfileClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionsByBillingProfileClient) ListPreparer(ctx context.Context, billingAccountName string, billingProfileName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/billingSubscriptions", 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 SubscriptionsByBillingProfileClient) 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 SubscriptionsByBillingProfileClient) ListResponder(resp *http.Response) (result SubscriptionsListResult, 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/subscriptionsbyinvoicesection.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptionsbyinvoicesection.go deleted file mode 100644 index 42c88e841c05..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/subscriptionsbyinvoicesection.go +++ /dev/null @@ -1,119 +0,0 @@ -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" -) - -// SubscriptionsByInvoiceSectionClient is the billing client provides access to billing resources for Azure -// subscriptions. -type SubscriptionsByInvoiceSectionClient struct { - BaseClient -} - -// NewSubscriptionsByInvoiceSectionClient creates an instance of the SubscriptionsByInvoiceSectionClient client. -func NewSubscriptionsByInvoiceSectionClient(subscriptionID string) SubscriptionsByInvoiceSectionClient { - return NewSubscriptionsByInvoiceSectionClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubscriptionsByInvoiceSectionClientWithBaseURI creates an instance of the SubscriptionsByInvoiceSectionClient -// client. -func NewSubscriptionsByInvoiceSectionClientWithBaseURI(baseURI string, subscriptionID string) SubscriptionsByInvoiceSectionClient { - return SubscriptionsByInvoiceSectionClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists billing subscription by invoiceSectionName. -// Parameters: -// billingAccountName - billing Account Id. -// invoiceSectionName - invoiceSection Id. -func (client SubscriptionsByInvoiceSectionClient) List(ctx context.Context, billingAccountName string, invoiceSectionName string) (result SubscriptionsListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubscriptionsByInvoiceSectionClient.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) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionsByInvoiceSectionClient", "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.SubscriptionsByInvoiceSectionClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.SubscriptionsByInvoiceSectionClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client SubscriptionsByInvoiceSectionClient) ListPreparer(ctx context.Context, billingAccountName string, invoiceSectionName 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, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/invoiceSections/{invoiceSectionName}/billingSubscriptions", 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 SubscriptionsByInvoiceSectionClient) 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 SubscriptionsByInvoiceSectionClient) ListResponder(resp *http.Response) (result SubscriptionsListResult, 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/transactions.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactions.go new file mode 100644 index 000000000000..06086e93a20f --- /dev/null +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactions.go @@ -0,0 +1,335 @@ +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" +) + +// TransactionsClient is the billing client provides access to billing resources for Azure subscriptions. +type TransactionsClient struct { + BaseClient +} + +// NewTransactionsClient creates an instance of the TransactionsClient client. +func NewTransactionsClient(subscriptionID string) TransactionsClient { + return NewTransactionsClientWithBaseURI(DefaultBaseURI, subscriptionID) +} + +// NewTransactionsClientWithBaseURI creates an instance of the TransactionsClient client. +func NewTransactionsClientWithBaseURI(baseURI string, subscriptionID string) TransactionsClient { + return TransactionsClient{NewWithBaseURI(baseURI, subscriptionID)} +} + +// ListByBillingAccountName lists the transactions by billing account name for given start and end date. +// Parameters: +// billingAccountName - billing Account 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 TransactionsClient) ListByBillingAccountName(ctx context.Context, billingAccountName string, startDate string, endDate string, filter string) (result TransactionsListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.tlr.Response.Response != nil { + sc = result.tlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.fn = client.listByBillingAccountNameNextResults + req, err := client.ListByBillingAccountNamePreparer(ctx, billingAccountName, startDate, endDate, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByBillingAccountName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.tlr.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByBillingAccountName", resp, "Failure sending request") + return + } + + result.tlr, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByBillingAccountName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingAccountNamePreparer prepares the ListByBillingAccountName request. +func (client TransactionsClient) ListByBillingAccountNamePreparer(ctx context.Context, billingAccountName string, startDate string, endDate string, filter 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, + "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}/transactions", 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 TransactionsClient) 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 TransactionsClient) ListByBillingAccountNameResponder(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 +} + +// listByBillingAccountNameNextResults retrieves the next set of results, if any. +func (client TransactionsClient) listByBillingAccountNameNextResults(ctx context.Context, lastResults TransactionsListResult) (result TransactionsListResult, err error) { + req, err := lastResults.transactionsListResultPreparer(ctx) + if err != nil { + return result, autorest.NewErrorWithError(err, "billing.TransactionsClient", "listByBillingAccountNameNextResults", nil, "Failure preparing next results request") + } + if req == nil { + return + } + resp, err := client.ListByBillingAccountNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + return result, autorest.NewErrorWithError(err, "billing.TransactionsClient", "listByBillingAccountNameNextResults", resp, "Failure sending next results request") + } + result, err = client.ListByBillingAccountNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "listByBillingAccountNameNextResults", resp, "Failure responding to next results request") + } + return +} + +// ListByBillingAccountNameComplete enumerates all values, automatically crossing page boundaries as required. +func (client TransactionsClient) ListByBillingAccountNameComplete(ctx context.Context, billingAccountName string, startDate string, endDate string, filter string) (result TransactionsListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsClient.ListByBillingAccountName") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + result.page, err = client.ListByBillingAccountName(ctx, billingAccountName, startDate, endDate, filter) + return +} + +// ListByBillingProfileName lists the transactions by billing profile name 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 TransactionsClient) ListByBillingProfileName(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+"/TransactionsClient.ListByBillingProfileName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByBillingProfileNamePreparer(ctx, billingAccountName, billingProfileName, startDate, endDate, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByBillingProfileName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByBillingProfileNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByBillingProfileName", resp, "Failure sending request") + return + } + + result, err = client.ListByBillingProfileNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByBillingProfileName", resp, "Failure responding to request") + } + + return +} + +// ListByBillingProfileNamePreparer prepares the ListByBillingProfileName request. +func (client TransactionsClient) ListByBillingProfileNamePreparer(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)) +} + +// ListByBillingProfileNameSender sends the ListByBillingProfileName request. The method will close the +// http.Response Body if it receives an error. +func (client TransactionsClient) ListByBillingProfileNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByBillingProfileNameResponder handles the response to the ListByBillingProfileName request. The method always +// closes the http.Response Body. +func (client TransactionsClient) ListByBillingProfileNameResponder(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 +} + +// ListByInvoiceSectionName lists the transactions by invoice section name 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 TransactionsClient) ListByInvoiceSectionName(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+"/TransactionsClient.ListByInvoiceSectionName") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + req, err := client.ListByInvoiceSectionNamePreparer(ctx, billingAccountName, invoiceSectionName, startDate, endDate, filter) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByInvoiceSectionName", nil, "Failure preparing request") + return + } + + resp, err := client.ListByInvoiceSectionNameSender(req) + if err != nil { + result.Response = autorest.Response{Response: resp} + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByInvoiceSectionName", resp, "Failure sending request") + return + } + + result, err = client.ListByInvoiceSectionNameResponder(resp) + if err != nil { + err = autorest.NewErrorWithError(err, "billing.TransactionsClient", "ListByInvoiceSectionName", resp, "Failure responding to request") + } + + return +} + +// ListByInvoiceSectionNamePreparer prepares the ListByInvoiceSectionName request. +func (client TransactionsClient) ListByInvoiceSectionNamePreparer(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)) +} + +// ListByInvoiceSectionNameSender sends the ListByInvoiceSectionName request. The method will close the +// http.Response Body if it receives an error. +func (client TransactionsClient) ListByInvoiceSectionNameSender(req *http.Request) (*http.Response, error) { + return autorest.SendWithSender(client, req, + autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) +} + +// ListByInvoiceSectionNameResponder handles the response to the ListByInvoiceSectionName request. The method always +// closes the http.Response Body. +func (client TransactionsClient) ListByInvoiceSectionNameResponder(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/transactionsbybillingaccount.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbybillingaccount.go deleted file mode 100644 index 2b8ee1e543cf..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbybillingaccount.go +++ /dev/null @@ -1,165 +0,0 @@ -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" -) - -// TransactionsByBillingAccountClient is the billing client provides access to billing resources for Azure -// subscriptions. -type TransactionsByBillingAccountClient struct { - BaseClient -} - -// NewTransactionsByBillingAccountClient creates an instance of the TransactionsByBillingAccountClient client. -func NewTransactionsByBillingAccountClient(subscriptionID string) TransactionsByBillingAccountClient { - return NewTransactionsByBillingAccountClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewTransactionsByBillingAccountClientWithBaseURI creates an instance of the TransactionsByBillingAccountClient -// client. -func NewTransactionsByBillingAccountClientWithBaseURI(baseURI string, subscriptionID string) TransactionsByBillingAccountClient { - return TransactionsByBillingAccountClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists the transactions by billingAccountName for given start and end date. -// Parameters: -// billingAccountName - billing Account 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 TransactionsByBillingAccountClient) List(ctx context.Context, billingAccountName string, startDate string, endDate string, filter string) (result TransactionsListResultPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsByBillingAccountClient.List") - defer func() { - sc := -1 - if result.tlr.Response.Response != nil { - sc = result.tlr.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, billingAccountName, startDate, endDate, filter) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingAccountClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.tlr.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingAccountClient", "List", resp, "Failure sending request") - return - } - - result.tlr, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingAccountClient", "List", resp, "Failure responding to request") - } - - return -} - -// ListPreparer prepares the List request. -func (client TransactionsByBillingAccountClient) ListPreparer(ctx context.Context, billingAccountName string, startDate string, endDate string, filter 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, - "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}/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 TransactionsByBillingAccountClient) 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 TransactionsByBillingAccountClient) 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 -} - -// listNextResults retrieves the next set of results, if any. -func (client TransactionsByBillingAccountClient) listNextResults(ctx context.Context, lastResults TransactionsListResult) (result TransactionsListResult, err error) { - req, err := lastResults.transactionsListResultPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "billing.TransactionsByBillingAccountClient", "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, "billing.TransactionsByBillingAccountClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "billing.TransactionsByBillingAccountClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client TransactionsByBillingAccountClient) ListComplete(ctx context.Context, billingAccountName string, startDate string, endDate string, filter string) (result TransactionsListResultIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/TransactionsByBillingAccountClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, billingAccountName, startDate, endDate, filter) - return -} 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 deleted file mode 100644 index 104ce634b9cd..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbybillingprofile.go +++ /dev/null @@ -1,129 +0,0 @@ -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 deleted file mode 100644 index 21de62d24528..000000000000 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/transactionsbyinvoicesection.go +++ /dev/null @@ -1,129 +0,0 @@ -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 -} diff --git a/services/preview/billing/mgmt/2018-11-01-preview/billing/transfers.go b/services/preview/billing/mgmt/2018-11-01-preview/billing/transfers.go index 52aebc174c8c..b66feb396bff 100644 --- a/services/preview/billing/mgmt/2018-11-01-preview/billing/transfers.go +++ b/services/preview/billing/mgmt/2018-11-01-preview/billing/transfers.go @@ -184,7 +184,7 @@ func (client TransfersClient) GetResponder(resp *http.Response) (result Transfer return } -// Initiate initiates the request to transfer the GTM or legacy subscriptions or RIs to GTM. +// Initiate initiates the request to transfer the legacy subscriptions or RIs. // Parameters: // billingAccountName - billing Account Id. // invoiceSectionName - invoiceSection Id.