/gorhsm

Go bindings for Red Hat Subscription Manager

Primary LanguageGoMIT LicenseMIT

Go API client for gorhsm

API for Red Hat Subscription Management

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/net/context

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

import gorhsm "github.com/umich-vci/gorhsm"

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 sw.ContextServerIndex of type int.

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

Templated Server URL

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

ctx := context.WithValue(context.Background(), gorhsm.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 sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

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

Documentation for API Endpoints

All URIs are relative to https://api.access.redhat.com/management/v1

Class Method HTTP request Description
AllocationApi AttachEntitlementAllocation Post /allocations/{uuid}/entitlements Attach entitlement to allocation
AllocationApi CreateSatellite Post /allocations Create Satellite
AllocationApi ExportAllocation Get /allocations/{uuid}/export Trigger allocation manifest export
AllocationApi ExportJobAllocation Get /allocations/{uuid}/exportJob/{ExportJobID} Check status of allocation manifest export
AllocationApi GetExportAllocation Get /allocations/{uuid}/export/{ExportID} Download allocation manifest
AllocationApi ListAllocationPools Get /allocations/{uuid}/pools List all pools for an allocation
AllocationApi ListAllocations Get /allocations List all allocations for a user
AllocationApi ListVersionsAllocation Get /allocations/versions List Satellite versions
AllocationApi RemoveAllocation Delete /allocations/{uuid} Remove allocation profile
AllocationApi RemoveAllocationEntitlement Delete /allocations/{uuid}/entitlements/{EntitlementID} Remove entitlement from the allocation
AllocationApi RemoveAllocationEntitlementDeprecated Delete /allocations/{uuid}/{EntitlementID} Remove entitlement from the allocation
AllocationApi ShowAllocation Get /allocations/{uuid} Get an allocation by UUID
AllocationApi UpdateAllocation Put /allocations/{uuid} Update an allocation
AllocationApi UpdateEntitlementAllocation Put /allocations/{uuid}/entitlements/{EntitlementID} Update attached entitlement to allocation
CloudaccessApi AddProviderAccounts Post /cloud_access_providers/{ProviderShortName}/accounts Add accounts for a provider
CloudaccessApi EnableGoldImages Post /cloud_access_providers/{ProviderShortName}/goldimage Enable Gold image access
CloudaccessApi ListEnabledCloudAccessProviders Get /cloud_access_providers/enabled List all enabled cloud access providers for a user
CloudaccessApi RemoveProviderAccount Delete /cloud_access_providers/{ProviderShortName}/accounts Remove a provider account
CloudaccessApi UpdateProviderAccount Put /cloud_access_providers/{ProviderShortName}/accounts/{AccountID} Update provider account
CloudaccessApi VerifyProviderAccount Put /cloud_access_providers/{ProviderShortName}/accounts/{AccountID}/verification Verify a provider account
ErrataApi ListErrata Get /errata List all errata for a user's systems
ErrataApi ListErrataByContentSetArch Get /errata/cset/{ContentSet}/arch/{Arch} Get all the errata for the specified content set and arch
ErrataApi ListErratumPackages Get /errata/{AdvisoryID}/packages List all packages for an advisory
ErrataApi ListErratumSystems Get /errata/{AdvisoryID}/systems List all systems for an advisory
ErrataApi ShowErratum Get /errata/{AdvisoryID} Get the details of an advisory
ImagesApi DownloadImage Get /images/{checksum}/download Download an image by its SHA256 checksum
ImagesApi ListImageDownloadsByVersionArch Get /images/rhel/{Version}/{Arch} List RHEL image downloads by version and architecture.
ImagesApi ListImagesByContentSet Get /images/cset/{ContentSet} List available images in a content set
OrganizationApi CheckOrgSCACapability Get /organization Get details of the user's organization
PackagesApi DownloadPackage Get /packages/{checksum}/download Download a package by its SHA256 checksum
PackagesApi ListPackagesByContentSetArch Get /packages/cset/{ContentSet}/arch/{Arch} Get all the packages for the specified content set and arch.
PackagesApi ShowPackage Get /packages/{Checksum} Get the details of a package
SubscriptionApi ListSubContentSets Get /subscriptions/{SubscriptionNumber}/contentSets List all content sets for a subscription
SubscriptionApi ListSubSystems Get /subscriptions/{SubscriptionNumber}/systems List all systems consuming a subscription
SubscriptionApi ListSubscriptions Get /subscriptions List all subscriptions for a user
SystemApi AttachEntitlement Post /systems/{SystemUUID}/entitlements Attach entitlement to system
SystemApi ListSystemErrata Get /systems/{SystemUUID}/errata List all applicable errata for a system
SystemApi ListSystemPackages Get /systems/{SystemUUID}/packages List all packages for a system
SystemApi ListSystemPools Get /systems/{SystemUUID}/pools List all pools for a system
SystemApi ListSystems Get /systems List all systems for a user
SystemApi RemoveSystem Delete /systems/{SystemUUID} Remove system profile
SystemApi RemoveSystemEntitlement Delete /systems/{SystemUUID}/{EntitlementID} Remove entitlement from the system
SystemApi ShowSystem Get /systems/{SystemUUID} Get a system specified by UUID.

Documentation For Models

Documentation For Authorization

Bearer

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Authorization and passed in as the auth context for each request.

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