Skip to content

umich-vci/gorhsm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

  • API version: 1.366.0
  • Package version: 1.0.0
  • Generator version: 7.4.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://access.redhat.com/support/cases/

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 gorhsm.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 gorhsm.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 gorhsm.ContextOperationServerIndices and gorhsm.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 RemoveProviderAccountBySourceID Delete /cloud_access_providers/accounts Remove a provider account by source id
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 ListErratumImages Get /errata/{AdvisoryID}/images List all updated container images for an advisory
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

Authentication schemes defined for the API:

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.

Example

auth := context.WithValue(
		context.Background(),
		gorhsm.ContextAPIKeys,
		map[string]gorhsm.APIKey{
			"Authorization": {Key: "API_KEY_STRING"},
		},
	)
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