Categorygithub.com/phoenixnap/go-sdk-bmc/billingapi/v3
modulepackage
3.0.0
Repository: https://github.com/phoenixnap/go-sdk-bmc.git
Documentation: pkg.go.dev

# README

Go API client for billingapi

Automate your infrastructure billing with the Bare Metal Cloud Billing API. Reserve your server instances to ensure guaranteed resource availability for 12, 24, and 36 months. Retrieve your server’s rated usage for a given period and enable or disable auto-renewals.

Knowledge base articles to help you can be found here

All URLs are relative to (https://api.phoenixnap.com/billing/v1/)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import billingapi "github.com/phoenixnap/go-sdk-bmc/billingapi"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value billingapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), billingapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value billingapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), billingapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using billingapi.ContextOperationServerIndices and billingapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), billingapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), billingapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.phoenixnap.com/billing/v1

ClassMethodHTTP requestDescription
BillingConfigurationsAPIAccountBillingConfigurationMeGetGet /account-billing-configurations/meRetrieves billing configuration associated with the authenticated account.
ProductAvailabilityAPIProductAvailabilityGetGet /product-availabilityList all Product availabilities.
ProductsAPIProductsGetGet /productsList all Products.
RatedUsageAPIRatedUsageGetGet /rated-usageList the rated usage.
RatedUsageAPIRatedUsageMonthToDateGetGet /rated-usage/month-to-dateList the rated usage records for the current calendar month.
ReservationsAPIReservationsGetGet /reservationsList all Reservations.
ReservationsAPIReservationsPostPost /reservationsCreate a reservation.
ReservationsAPIReservationsReservationIdActionsAutoRenewDisablePostPost /reservations/{id}/actions/auto-renew/disableDisable auto-renewal for reservation by id.
ReservationsAPIReservationsReservationIdActionsAutoRenewEnablePostPost /reservations/{id}/actions/auto-renew/enableEnable auto-renewal for unexpired reservation by reservation id.
ReservationsAPIReservationsReservationIdActionsConvertPostPost /reservations/{id}/actions/convertConvert reservation pricing model by reservation ID.
ReservationsAPIReservationsReservationIdGetGet /reservations/{id}Get a reservation.

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

OAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes:
  • bmc: Grants full access to bmc-api.
  • bmc.read: Grants read only access to bmc-api.

Example

auth := context.WithValue(context.Background(), billingapi.ContextAccessToken, "ACCESSTOKENSTRING")
r, err := client.Service.Operation(auth, args)

Or via OAuth2 module to automatically refresh tokens and perform user authentication.

import "golang.org/x/oauth2"

/* Perform OAuth2 round trip request and obtain a token */

tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token)
auth := context.WithValue(oauth2.NoContext, billingapi.ContextOAuth2, tokenSource)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]

# Functions

BandwidthRecordAsRatedUsageGet200ResponseInner is a convenience function that returns BandwidthRecord wrapped in RatedUsageGet200ResponseInner.
CacheExpires helper function to determine remaining time before repeating a request.
IsNil checks if an input is nil.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResponse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewApplicableDiscounts instantiates a new ApplicableDiscounts object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewApplicableDiscountsWithDefaults instantiates a new ApplicableDiscounts object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewBandwidthDetails instantiates a new BandwidthDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewBandwidthDetailsWithDefaults instantiates a new BandwidthDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewBandwidthRecord instantiates a new BandwidthRecord object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewBandwidthRecordWithDefaults instantiates a new BandwidthRecord object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewConfiguration returns a new Configuration object.
NewConfigurationDetails instantiates a new ConfigurationDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewConfigurationDetailsWithDefaults instantiates a new ConfigurationDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewDiscountDetails instantiates a new DiscountDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewDiscountDetailsWithDefaults instantiates a new DiscountDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewError instantiates a new Error object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewErrorWithDefaults instantiates a new Error object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewLocationAvailabilityDetail instantiates a new LocationAvailabilityDetail object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewLocationAvailabilityDetailWithDefaults instantiates a new LocationAvailabilityDetail object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewLocationEnumFromValue returns a pointer to a valid LocationEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewOperatingSystemDetails instantiates a new OperatingSystemDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewOperatingSystemDetailsWithDefaults instantiates a new OperatingSystemDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewOperatingSystemRecord instantiates a new OperatingSystemRecord object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewOperatingSystemRecordWithDefaults instantiates a new OperatingSystemRecord object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewPackageUnitEnumFromValue returns a pointer to a valid PackageUnitEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewPriceUnitEnumFromValue returns a pointer to a valid PriceUnitEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewPricingPlan instantiates a new PricingPlan object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPricingPlanWithDefaults instantiates a new PricingPlan object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewProduct instantiates a new Product object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewProductAvailability instantiates a new ProductAvailability object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewProductAvailabilityWithDefaults instantiates a new ProductAvailability object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewProductCategoryEnumFromValue returns a pointer to a valid ProductCategoryEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewProductWithDefaults instantiates a new Product object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewPublicSubnetDetails instantiates a new PublicSubnetDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPublicSubnetDetailsWithDefaults instantiates a new PublicSubnetDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewPublicSubnetRecord instantiates a new PublicSubnetRecord object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewPublicSubnetRecordWithDefaults instantiates a new PublicSubnetRecord object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewRatedUsageRecord instantiates a new RatedUsageRecord object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewRatedUsageRecordWithDefaults instantiates a new RatedUsageRecord object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewReservation instantiates a new Reservation object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewReservationAutoRenewDisableRequest instantiates a new ReservationAutoRenewDisableRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewReservationAutoRenewDisableRequestWithDefaults instantiates a new ReservationAutoRenewDisableRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewReservationInvoicingModelEnumFromValue returns a pointer to a valid ReservationInvoicingModelEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewReservationModelEnumFromValue returns a pointer to a valid ReservationModelEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewReservationProductCategoryEnumFromValue returns a pointer to a valid ReservationProductCategoryEnum for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewReservationRequest instantiates a new ReservationRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewReservationRequestWithDefaults instantiates a new ReservationRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewReservationWithDefaults instantiates a new Reservation object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewServerDetails instantiates a new ServerDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewServerDetailsWithDefaults instantiates a new ServerDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewServerProduct instantiates a new ServerProduct object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewServerProductMetadata instantiates a new ServerProductMetadata object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewServerProductMetadataWithDefaults instantiates a new ServerProductMetadata object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewServerProductWithDefaults instantiates a new ServerProduct object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewServerRecord instantiates a new ServerRecord object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewServerRecordWithDefaults instantiates a new ServerRecord object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewStorageDetails instantiates a new StorageDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewStorageDetailsWithDefaults instantiates a new StorageDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewStorageRecord instantiates a new StorageRecord object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewStorageRecordWithDefaults instantiates a new StorageRecord object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewThresholdConfigurationDetails instantiates a new ThresholdConfigurationDetails object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewThresholdConfigurationDetailsWithDefaults instantiates a new ThresholdConfigurationDetails object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
OperatingSystemRecordAsRatedUsageGet200ResponseInner is a convenience function that returns OperatingSystemRecord wrapped in RatedUsageGet200ResponseInner.
ProductAsProductsGet200ResponseInner is a convenience function that returns Product wrapped in ProductsGet200ResponseInner.
PtrBool is a helper routine that returns a pointer to given boolean value.
PtrFloat32 is a helper routine that returns a pointer to given float value.
PtrFloat64 is a helper routine that returns a pointer to given float value.
PtrInt is a helper routine that returns a pointer to given integer value.
PtrInt32 is a helper routine that returns a pointer to given integer value.
PtrInt64 is a helper routine that returns a pointer to given integer value.
PtrString is a helper routine that returns a pointer to given string value.
PtrTime is helper routine that returns a pointer to given Time value.
PublicSubnetRecordAsRatedUsageGet200ResponseInner is a convenience function that returns PublicSubnetRecord wrapped in RatedUsageGet200ResponseInner.
ServerProductAsProductsGet200ResponseInner is a convenience function that returns ServerProduct wrapped in ProductsGet200ResponseInner.
ServerRecordAsRatedUsageGet200ResponseInner is a convenience function that returns ServerRecord wrapped in RatedUsageGet200ResponseInner.
StorageRecordAsRatedUsageGet200ResponseInner is a convenience function that returns StorageRecord wrapped in RatedUsageGet200ResponseInner.

# Constants

List of LocationEnum.
List of LocationEnum.
List of LocationEnum.
List of LocationEnum.
List of LocationEnum.
List of LocationEnum.
List of LocationEnum.
List of PackageUnitEnum.
List of PackageUnitEnum.
List of PriceUnitEnum.
List of PriceUnitEnum.
List of PriceUnitEnum.
List of PriceUnitEnum.
List of PriceUnitEnum.
List of PriceUnitEnum.
List of ProductCategoryEnum.
List of ProductCategoryEnum.
List of ProductCategoryEnum.
List of ProductCategoryEnum.
List of ProductCategoryEnum.
List of ReservationInvoicingModelEnum.
List of ReservationInvoicingModelEnum.
List of ReservationModelEnum.
List of ReservationModelEnum.
List of ReservationModelEnum.
List of ReservationModelEnum.
List of ReservationModelEnum.
List of ReservationProductCategoryEnum.
List of ReservationProductCategoryEnum.
No description provided by the author

# Variables

All allowed values of LocationEnum enum.
All allowed values of PackageUnitEnum enum.
All allowed values of PriceUnitEnum enum.
All allowed values of ProductCategoryEnum enum.
All allowed values of ReservationInvoicingModelEnum enum.
All allowed values of ReservationModelEnum enum.
All allowed values of ReservationProductCategoryEnum enum.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextServerIndex uses a server configuration from the index.
ContextServerVariables overrides a server configuration variables.
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
APIClient manages communication with the Billing API API v0.1 In most cases there should be only one, shared, APIClient.
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIResponse stores the API response returned by the server.
ApplicableDiscounts Represents the applicable discount details for a product, including the discounted price and discount information.
BandwidthDetails Details of the bandwidth associated with this rated usage record.
BandwidthRecord struct for BandwidthRecord.
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
Configuration stores the configuration of the API client.
ConfigurationDetails Billing configuration details.
DiscountDetails Represents the details of a discount applied to a product or charge.
Error struct for Error.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
LocationAvailabilityDetail Info about location, solutions and availability for a product.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
OperatingSystemDetails Details of the operating system associated with this rated usage record.
OperatingSystemRecord struct for OperatingSystemRecord.
PricingPlan Pricing plan details.
Product Product details.
ProductAvailability Product availability details.
ProductsGet200ResponseInner - struct for ProductsGet200ResponseInner.
PublicSubnetDetails Details of public subnets.
PublicSubnetRecord struct for PublicSubnetRecord.
RatedUsageGet200ResponseInner - struct for RatedUsageGet200ResponseInner.
RatedUsageRecord Rated usage record.
Reservation Reservation details.
ReservationAutoRenewDisableRequest Disabling auto-renewal for reservation request.
ReservationRequest Reservation request.
ServerConfiguration stores the information about a server.
ServerDetails Details of the server associated with this rated usage record.
ServerProduct struct for ServerProduct.
ServerProductMetadata Details of the server product.
ServerRecord struct for ServerRecord.
ServerVariable stores the information about a server variable.
StorageDetails Details of the storage associated with this rated usage record.
StorageRecord struct for StorageRecord.
ThresholdConfigurationDetails Threshold billing configuration.

# Interfaces

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

BillingConfigurationsAPIService BillingConfigurationsAPI service.
LocationEnum The location code.
PackageUnitEnum Package size unit.
PriceUnitEnum The unit to which the price applies.
ProductAvailabilityAPIService ProductAvailabilityAPI service.
ProductCategoryEnum The product category.
ProductsAPIService ProductsAPI service.
RatedUsageAPIService RatedUsageAPI service.
ReservationInvoicingModelEnum Reservations created with initial invoice model ON_CREATION will be invoiced on same date when reservation is created.
ReservationModelEnum The reservation model.
ReservationProductCategoryEnum The commitment product category.
ReservationsAPIService ReservationsAPI service.
ServerConfigurations stores multiple ServerConfiguration items.