Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PostHandler ¶
func PostHandler(pattern string, subs *[]Subscription) echo.HandlerFunc
PostHandler is the POST method handler for /subscriptions POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/billingProfiles/{billingProfileName}/invoiceSections/{invoiceSectionName}/providers/Microsoft.Subscription/createSubscription?api-version=2018-11-01-preview 202 Accepted
Response: { "subscriptionLink": "/subscriptions/d0d6ee57-6530-4fca-93a6-b755a070be35" }
Types ¶
type Response ¶
type Response struct { Value []Subscription `json:"value"` Count struct { Type string `json:"type"` Value int `json:"value"` } `json:"count"` }
Response models the subscription response from the API
func NewResponseStub ¶
NewResponseStub takes a string ID and returns a basic SubscriptionResponse object TODO: Support passing multiple subscription IDs
type Service ¶
Service satisfies the Service interface, and is used to start and maintain the Subscription Service
func NewService ¶
NewService is a factory for the SubscriptionService, which satisfies the services.Service interface and provides a default sub TODO Error handling
func (*Service) AddSubscription ¶
func (svc *Service) AddSubscription(s Subscription) error
AddSubscription takes a subscription and adds it to the store
func (*Service) GetBaseSubscriptionID ¶
GetBaseSubscriptionID is a SubscriptionService specific helper that returns the initial subscriptionID
func (*Service) GetHandler ¶
func (svc *Service) GetHandler() echo.HandlerFunc
GetHandler is the GET method handler for /subscriptions
func (*Service) GetHandlers ¶
GetHandlers returns a map of all HTTP Echo handlers that the service needs in order to operate
func (*Service) GetSubscriptions ¶
func (svc *Service) GetSubscriptions() ([]Subscription, error)
GetSubscriptions returns the Stores state
type Subscription ¶
type Subscription struct { ID string `json:"id"` AuthorizationSource string `json:"authorizationSource"` ManagedByTenants []interface{} `json:"managedByTenants"` SubscriptionID string `json:"subscriptionId"` TenantID string `json:"tenantId"` DisplayName string `json:"displayName"` State string `json:"state"` SubscriptionPolicies struct { LocationPlacementID string `json:"locationPlacementId"` QuotaID string `json:"quotaId"` SpendingLimit string `json:"spendingLimit"` } `json:"subscriptionPolicies"` }
Subscription is the object we store in our Inventory grab bag to model a subscription
func NewSubscription ¶
func NewSubscription() Subscription
NewSubscription takes a string ID and returns a basic Subscription object It does this by indirectly using the NewSubscriptionResponse factory for the sake of loading in a JSON stub,
and replacing the SubscriptionID in said stub to constructr our Subscription.