rsat

package
v0.1.16-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package rsat provides support for processing APIs hosted by a Red Hat Satellite (RSAT) instance.

See API documentation:

- https://access.redhat.com/documentation/en-us/red_hat_satellite - https://rsat.example.com/apidoc/v2.html

Index

Constants

View Source
const (
	// StandardAPITimeLayoutWithTimezone is the time layout format as used by
	// the Red Hat Satellite API for the majority of the date/time properties
	// when the user has their Satellite account timezone setting configured
	// as `(GMT+00:00) UTC`.
	//
	// Examples (from JSON API response) for Satellite 6.15:
	//
	// "created_at": "2024-05-09 21:14:51 UTC",
	// "updated_at": "2024-05-09 21:14:51 UTC",
	//
	// See also https://rsat.example.com/apidoc/v2/sync_plans/index.html
	StandardAPITimeLayoutWithTimezone string = "2006-01-02 15:04:05 UTC"

	// StandardAPITimeLayoutWithOffset is the time layout format as used by
	// the Red Hat Satellite API for the majority of the date/time properties
	// when the user has their Satellite account timezone setting configured
	// as `Browser timezone`.
	//
	// Examples (from JSON API response):
	//
	// "created_at": "2024-05-09 16:14:51 -0500",
	// "updated_at": "2024-05-09 16:14:51 -0500",
	//
	// See also https://rsat.example.com/apidoc/v2/sync_plans/index.html
	StandardAPITimeLayoutWithOffset string = "2006-01-02 15:04:05 -0700"

	// SyncTimeLayoutWithTimezone is the time layout format as used by current
	// versions of the Red Hat Satellite Sync Plans API for the next_sync
	// property in current versions of Red Hat Satellite when the user has
	// their Satellite account timezone setting configured as `(GMT+00:00)
	// UTC`.
	//
	// Example: "next_sync": "2024-05-10 17:14:00 UTC",
	//
	// See also https://rsat.example.com/apidoc/v2/sync_plans/index.html
	SyncTimeLayoutWithTimezone string = "2006-01-02 15:04:05 UTC"

	// SyncTimeLayoutWithOffset is the time layout format as used by current
	// versions of the Red Hat Satellite Sync Plans API for the next_sync
	// property when the user has their Satellite account timezone setting
	// configured as `Browser timezone`.
	//
	// Example: "next_sync": "2024/05/10 15:16:00 -0500",
	//
	// See also https://rsat.example.com/apidoc/v2/sync_plans/index.html
	SyncTimeLayoutWithOffset string = "2006-01-02 15:04:05 -0700"

	// LegacySyncTimeLayout is the time layout format as used by legacy
	// versions of the Red Hat Satellite Sync Plans API for the next_sync
	// property (e.g., Satellite 6.5).
	//
	// Example(account Timezone property is set to `(GMT+00:00) UTC`):
	//
	// "next_sync": "2024/05/10 20:16:00 +0000",
	//
	// Example(account Timezone property is set to `Browser timezone`):
	//
	// "next_sync": "2024/05/10 15:16:00 -0500",
	//
	// This layout works equally well for both.
	//
	// See also https://rsat.example.com/apidoc/v2/sync_plans/index.html
	LegacySyncTimeLayout string = "2006/01/02 15:04:05 -0700"
)

Time layouts observed "in the wild" for various versions of Red Hat Satellite.

View Source
const (
	// OrganizationsAPIEndPointURLTemplate provides a template for a fully
	// qualified API endpoint URL for retrieving Organizations from a Red Hat
	// Satellite instance.
	// OrganizationsAPIEndPointURLTemplate string = "https://%s:%d/api/v2/organizations?full_result=1&per_page=%d&page=%d"
	OrganizationsAPIEndPointURLTemplate string = "https://%s:%d/api/v2/organizations"

	// SubscriptionsAPIEndPointURLTemplate provides a template for a fully
	// qualified API endpoint URL for retrieving Subscriptions associated with
	// a Red Hat Satellite Organization.
	// SubscriptionsAPIEndPointURLTemplate string = "https://%s:%d/katello/api/v2/organizations/%d/subscriptions?full_result=1&per_page=%d&page=%d"
	SubscriptionsAPIEndPointURLTemplate string = "https://%s:%d/katello/api/v2/organizations/%d/subscriptions"

	// SyncPlansAPIEndPointURLTemplate provides a template for a fully
	// qualified API endpoint URL for retrieving Sync Plans associated with a
	// Red Hat Satellite Organization.
	// SyncPlansAPIEndPointURLTemplate string = "https://%s:%d/katello/api/v2/organizations/%d/sync_plans?full_result=1&per_page=%d&page=%d"
	SyncPlansAPIEndPointURLTemplate string = "https://%s:%d/katello/api/v2/organizations/%d/sync_plans"

	// ProductsAPIEndPointURLTemplate provides a template for a fully
	// qualified API endpoint URL for retrieving Products associated with a
	// Red Hat Satellite Organization.
	// ProductsAPIEndPointURLTemplate string = "https://%s:%d/katello/api/v2/products?organization_id=%d&full_result=1&per_page=%d&page=%d"
	ProductsAPIEndPointURLTemplate string = "https://%s:%d/katello/api/v2/products"
)

Red Hat Satellite API endpoints URL templates.

View Source
const (
	APIEndpointURLQueryParamOrganizationIDKey string = "organization_id"
	APIEndpointURLQueryParamFullResultKey     string = "full_result"
	APIEndpointURLQueryParamPerPageKey        string = "per_page"
	APIEndpointURLQueryParamPageKey           string = "page"
)

Common/shared query parameter keys for Red Hat Satellite API endpoint URLs.

View Source
const (
	APIEndpointURLQueryParamFullResultDefaultValue string = "1"
	APIEndpointURLQueryParamPageStartingValue      string = "1"
)

Red Hat Satellite API endpoint URL query parameter default values.

View Source
const (
	PrepTaskParseURL         string = "parse URL"
	PrepTaskPrepareRequest   string = "prepare request"
	PrepTaskDecode           string = "decode JSON data"
	PrepTaskSubmitRequest    string = "submit request"
	PrepTaskValidateResponse string = "validate response"
)

Prep tasks for processing of Red Hat Satellite API endpoints.

View Source
const JSONNullKeyword string = "null"

JSONNullKeyword is the keyword used in JSON to represent null.

Variables

View Source
var (
	// ErrMissingValue indicates that an expected value was missing.
	ErrMissingValue = errors.New("missing expected value")

	// ErrHTTPResponseOutsideRange indicates that a response was received
	// which falls outside of an acceptable range.
	ErrHTTPResponseOutsideRange = errors.New("response is outside acceptable range")

	// ErrJSONUnexpectedObjectCount indicates that a response was received
	// with more provided JSON objects than expected.
	ErrJSONUnexpectedObjectCount = errors.New("unexpected JSON object count")
)

FIXME: Should we consistently use the PrepError type instead of using these sentinel errors?

Functions

This section is empty.

Types

type APIAuthInfo

type APIAuthInfo struct {
	// ReadLimit is the size in bytes used to help prevent abuse when reading
	// input that could be larger than expected.
	ReadLimit int64

	// Port is the TCP/IP port associated with the Red Hat Satellite server's
	// API endpoints.
	Port int

	// Server is the FQDN or IP Address of the Red Hat Satellite server.
	Server string

	// Username is the valid user for the specified Red Hat Satellite server.
	Username string

	// Password is the valid password for the specified Red Hat Satellite
	// Server user account.
	Password string

	// UserAgent is an optional custom user agent string used to override the
	// default Go user agent ("Go-http-client/1.1").
	UserAgent string

	// NetworkType indicates whether an attempt should be made to connect to
	// only IPv4, only IPv6 or Red Hat Satellite API endpoints listening on
	// either of IPv4 or IPv6 addresses ("auto").
	NetworkType string

	// CACert is the optional certificate authority certificate used to
	// validate the certificate chain used by the Red Hat Satellite server.
	CACert []byte

	// PermitTLSRenegotiation controls whether the server is allowed to
	// request TLS renegotiation.
	PermitTLSRenegotiation bool

	// TrustCert indicates whether the certificate should be trusted as-is
	// without validation.
	TrustCert bool
}

APIAuthInfo represents the settings needed to access Red Hat Satellite server API endpoints.

type APIClient

type APIClient struct {
	*http.Client
	AuthInfo APIAuthInfo
	Logger   zerolog.Logger
	Limits   APILimits
}

APIClient represents a customized HTTP client for interacting with Red Hat Satellite API endpoints.

func NewAPIClient

func NewAPIClient(apiAuthInfo APIAuthInfo, apiLimits APILimits, logger zerolog.Logger) *APIClient

NewAPIClient uses the provided API Auth details to construct a custom HTTP client used to interact with

type APILimits added in v0.1.10

type APILimits struct {
	PerPage int
}

APILimits represents the settings used to comply with the limits set by an API endpoint.

type Hypervisor

type Hypervisor struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
}

Hypervisor represents the hypervisor associated with a specific subscription. Not all subscriptions are associated with a hypervisor; subscriptions associated with a hypervisor require that a virtual guest be running on the indicated hypervisor (tracked via virt-who) to be eligible for that subscription (e.g., Red Hat Enterprise Linux Extended Life Cycle Support).

type NullString

type NullString string

NullString represents a string value that may potentially be null in the input JSON feed.

func (NullString) MarshalJSON

func (ns NullString) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. This compliments the custom Unmarshaler implementation to handle potentially null string field values in place of using an empty interface.

func (*NullString) UnmarshalJSON

func (ns *NullString) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface to handle potentially null string field values in place of using an empty interface.

type Organization

type Organization struct {
	CreatedAt   StandardAPITime `json:"created_at"`
	UpdatedAt   StandardAPITime `json:"updated_at"`
	Description NullString      `json:"description"`
	Label       string          `json:"label"`
	Name        string          `json:"name"`
	Title       string          `json:"title"`
	SyncPlans   SyncPlans       `json:"-"`
	// Products    Products        `json:"-"`
	// Hosts       Hosts           `json:"-"`
	ID int `json:"id"`
}

Organization is an isolated collection of systems, content, and other functionality within a Red Hat Satellite deployment.

func GetOrganizations

func GetOrganizations(ctx context.Context, client *APIClient) ([]Organization, error)

GetOrganizations uses the given client to retrieve all Red Hat Satellite organizations.

type Organizations

type Organizations []Organization

Organizations is a collection of Red Hat Satellite organizations.

func GetOrgsWithSyncPlans

func GetOrgsWithSyncPlans(ctx context.Context, client *APIClient) (Organizations, error)

GetOrgsWithSyncPlans uses the provided API client to retrieve all Red Hat Satellite organizations along with their sync plans.

func (Organizations) HasCriticalState

func (orgs Organizations) HasCriticalState() bool

HasCriticalState indicates whether any items in the collection were evaluated to a CRITICAL state.

func (Organizations) HasWarningState

func (orgs Organizations) HasWarningState() bool

HasWarningState indicates whether any items in the collection were evaluated to a WARNING state.

func (Organizations) IsOKState

func (orgs Organizations) IsOKState() bool

IsOKState indicates whether all items in the collection were evaluated to an OK state.

func (Organizations) NumOrgs

func (orgs Organizations) NumOrgs() int

NumOrgs returns the number of organizations in the collection.

func (Organizations) NumPlans

func (orgs Organizations) NumPlans() int

NumPlans returns the number of sync plans for all organizations in the collection.

func (Organizations) NumPlansDisabled

func (orgs Organizations) NumPlansDisabled() int

NumPlansDisabled returns the total number of sync plans for all organizations in the collection with disabled state.

func (Organizations) NumPlansEnabled

func (orgs Organizations) NumPlansEnabled() int

NumPlansEnabled returns the total number of sync plans for all organizations in the collection with enabled state.

func (Organizations) NumPlansStuck

func (orgs Organizations) NumPlansStuck() int

NumPlansStuck returns the total number of sync plans for all organizations in the collection with Next Sync state set to past date/time.

func (Organizations) NumProblemPlans

func (orgs Organizations) NumProblemPlans() int

NumProblemPlans returns the total number of sync plans for all organizations in the collection with a non-OK state.

func (Organizations) ServiceState

func (orgs Organizations) ServiceState() nagios.ServiceState

ServiceState returns the appropriate Service Check Status label and exit code for the collection's evaluation results.

func (Organizations) Sort

func (orgs Organizations) Sort()

Sort sorts the Organizations in the collection by name.

type OrganizationsResponse

type OrganizationsResponse struct {
	// Organizations is the collection of Organizations returned in the API
	// query response.
	Organizations []Organization `json:"results"`

	// Search is the search string based on scoped_scoped syntax.
	Search NullString `json:"search"`

	// Sort is the optional sorting criteria for API query responses.
	Sort SortOptions `json:"sort"`

	// Subtotal is the number of objects returned with the given search
	// parameters. If there is no search, then subtotal is equal to total.
	Subtotal int `json:"subtotal"`

	// Total is the total number of objects without any search parameters.
	Total int `json:"total"`

	// Page is the page number for the current query response results.
	//
	// NOTE: In practice, this value has been found to be  returned as an
	// integer in the first response and as a string value for each additional
	// page of results. The json.Number type accepts either format when
	// decoding the response.
	Page json.Number `json:"page"`

	// PerPage is the pagination limit applied to API query results. If not
	// specified by the client this is the default value set by the API.
	PerPage int `json:"per_page"`
}

OrganizationsResponse represents the API response from a request for all organizations in the Red Hat Satellite server.

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.5/html-single/api_guide/index#sect-API_Guide-Understanding_the_JSON_Response_Format https://access.redhat.com/documentation/en-us/red_hat_satellite/6.15/html-single/api_guide/index#sect-API_Guide-Understanding_the_JSON_Response_Format

type PrepError

type PrepError struct {

	// Step indicates the specific prep task which failed.
	//
	// NOTE: Constants should be used to make comparisons more reliable.
	Task string

	// Message provides additional (brief) context describing why the error
	// occurred.
	//
	// e.g., "error parsing URL" or "error preparing request for URL"
	Message string

	// Source associated with the prep task.
	//
	// e.g.,
	// "https://rsat.example.com/katello/api/v2/organizations/27/subscriptions"
	Source string

	// Cause is the underlying error which occurred while performing a task as
	// part of preparing a components set. This error is "bundled" for later
	// evaluation.
	Cause error
}

PrepError represents a class of errors encountered while performing tasks related to preparing a components Set.

func (*PrepError) Error

func (s *PrepError) Error() string

Error provides a human readable explanation for a components Set preparation task failure.

func (*PrepError) Is

func (s *PrepError) Is(target error) bool

Is supports error wrapping by indicating whether a given error matches the specific failed task associated with this error.

func (*PrepError) Unwrap

func (s *PrepError) Unwrap() error

Unwrap supports error wrapping by returning the enclosed error associated with the specific failed task was encountered as part of preparing a components Set.

type Product

type Product struct {
	LastSync        StandardAPITime `json:"last_sync"`
	Description     NullString      `json:"description"`
	CpID            string          `json:"cp_id"`
	Label           string          `json:"label"`
	LastSyncText    string          `json:"last_sync_words"`
	Name            string          `json:"name"`
	SyncState       string          `json:"sync_state"`
	ID              int             `json:"id"`
	RepositoryCount int             `json:"repository_count"`
}

Product is a collection of content repositories used to group custom repositories.

type Products

type Products []Product

Products is a collection of product values associated with a Red Hat Satellite sync plan.

type SortOptions

type SortOptions struct {
	// By specifies by what field the API sorts the collection.
	By NullString `json:"by"`

	// Order is the sort order, either ASC for ascending or DESC for
	// descending.
	Order NullString `json:"order"`
}

SortOptions is the optional sorting criteria for API query responses.

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.5/html-single/api_guide/index#sect-API_Guide-Understanding_the_JSON_Response_Format https://access.redhat.com/documentation/en-us/red_hat_satellite/6.15/html-single/api_guide/index#sect-API_Guide-Understanding_the_JSON_Response_Format

type StandardAPITime

type StandardAPITime time.Time

StandardAPITime is time value as represented in the Red Hat Satellite API for the majority of the date/time properties. It uses the StandardAPITimeLayout format.

func (StandardAPITime) Format

func (dt StandardAPITime) Format(layout string) string

Format calls (time.Time).Format as a convenience for the caller.

func (StandardAPITime) MarshalJSON

func (dt StandardAPITime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. This compliments the custom Unmarshaler implementation to handle conversion of a native Go time.Time format to a time value in a format that matches JSON API expectations.

func (StandardAPITime) String

func (dt StandardAPITime) String() string

String implements the fmt.Stringer interface as a convenience method.

func (*StandardAPITime) UnmarshalJSON

func (dt *StandardAPITime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface to handle converting a time string from the JSON API (most time properties) to a native Go time.Time value using a supported auto-detected layout.

type Subscription

type Subscription struct {
	Hypervisor         Hypervisor      `json:"hypervisor,omitempty"`
	StartDate          StandardAPITime `json:"start_date"`
	EndDate            StandardAPITime `json:"end_date"`
	Cores              interface{}     `json:"cores"`             // null is the only value I've encountered
	MultiEntitlement   *bool           `json:"multi_entitlement"` // null or true/false
	AccountNumber      *int            `json:"account_number"`    // null or integer
	Available          int             `json:"available"`
	Consumed           int             `json:"consumed"`
	Quantity           int             `json:"quantity"`
	SubscriptionID     int             `json:"subscription_id"`
	ID                 int             `json:"id"`
	InstanceMultiplier int             `json:"instance_multiplier"`
	RAM                NullString      `json:"ram"`
	Sockets            NullString      `json:"sockets"`
	StackingID         NullString      `json:"stacking_id"`
	SupportLevel       NullString      `json:"support_level"`
	UpstreamPoolID     NullString      `json:"upstream_pool_id"`
	CpID               string          `json:"cp_id"`
	Name               string          `json:"name"`
	ProductID          string          `json:"product_id"`
	ProductName        string          `json:"product_name"`
	Type               string          `json:"type"`
	UnmappedGuest      bool            `json:"unmapped_guest"`
	Upstream           bool            `json:"upstream"`
	VirtOnly           bool            `json:"virt_only"`
	VirtWho            bool            `json:"virt_who"`
}

Subscription represents an entitlement for receiving content and service from Red Hat. Subscription allocations are applied/managed separately within each Red Hat Satellite organization.

type SubscriptionsResponse

type SubscriptionsResponse struct {
	Error         NullString     `json:"error"`
	Organization  struct{}       `json:"organization"` // I have only encountered: "organization": {},
	Page          int            `json:"page"`
	PerPage       int            `json:"per_page"`
	Subscriptions []Subscription `json:"results"`
	Search        NullString     `json:"search"`
	Sort          SortOptions    `json:"sort"`
	Subtotal      int            `json:"subtotal"`
	Total         int            `json:"total"`
}

SubscriptionsResponse represents the API response from a request of all subscriptions for a specific organization.

type SyncPlan

type SyncPlan struct {
	OriginalSyncDate  SyncTime            `json:"sync_date"`
	NextSync          SyncTime            `json:"next_sync"`
	UpdatedAt         StandardAPITime     `json:"updated_at"`
	CreatedAt         StandardAPITime     `json:"created_at"`
	Products          Products            `json:"products"`
	CronExpression    NullString          `json:"cron_expression"`
	Description       NullString          `json:"description"`
	Interval          string              `json:"interval"`
	Name              string              `json:"name"`
	OrganizationName  string              `json:"-"`
	OrganizationLabel string              `json:"-"`
	OrganizationTitle string              `json:"-"`
	RecurringLogicID  int                 `json:"foreman_tasks_recurring_logic_id"`
	ID                int                 `json:"id"`
	OrganizationID    int                 `json:"organization_id"`
	Permissions       SyncPlanPermissions `json:"permissions"`
	Enabled           bool                `json:"enabled"`
}

SyncPlan represents a Red Hat Satellite sync plan. Sync plans are used to schedule execution of content synchronization.

func (SyncPlan) DaysStuck

func (sp SyncPlan) DaysStuck() int

DaysStuck indicates how many days the sync plan has been in a "stuck" state.

func (SyncPlan) DaysStuckHR

func (sp SyncPlan) DaysStuckHR() string

DaysStuckHR provides a human readable indication of how many days in the past the sync plan has been in a "stuck" state.

func (SyncPlan) IsOKState

func (sp SyncPlan) IsOKState() bool

IsOKState indicates whether any problems have been identified with this sync plan.

func (SyncPlan) IsStuck

func (sp SyncPlan) IsStuck() bool

IsStuck indicates whether (after any applied grace time) the sync plan is considered to be in a "stuck" state (Next Sync state set to past date/time).

Grace time is applied to help prevent flagging a sync plan that is "spinning up" or in a temporary pending status (e.g., on a busy system) as problematic.

NOTE: Very busy systems keeping sync plans in a pending state for an extended duration are still likely to be flagged as non-OK by current logic.

func (SyncPlan) NextSyncTime

func (sp SyncPlan) NextSyncTime() string

NextSyncTime provides a display friendly version of the next scheduled sync time for the sync plan.

type SyncPlanPermissions

type SyncPlanPermissions struct {
	DestroySyncPlans bool `json:"destroy_sync_plans"`
	EditSyncPlans    bool `json:"edit_sync_plans"`
	ViewSyncPlans    bool `json:"view_sync_plans"`
}

SyncPlanPermissions is the collection of permissions that a user querying the Red Hat Satellite API has for interacting with sync plans.

type SyncPlans

type SyncPlans []SyncPlan

SyncPlans is a collection of Red Hat Satellite sync plans.

func GetSyncPlans

func GetSyncPlans(ctx context.Context, client *APIClient, orgs ...Organization) (SyncPlans, error)

GetSyncPlans uses the provided APIClient to retrieve all sync plans for each specified Red Hat Satellite organization. If no organizations are specified then an attempt will be made to retrieve sync plans from all RSAT organizations.

func (SyncPlans) Disabled

func (sps SyncPlans) Disabled() SyncPlans

Disabled returns a new collection containing all sync plans from the original collection which are not in an enabled state.

func (SyncPlans) Enabled

func (sps SyncPlans) Enabled() SyncPlans

Enabled returns a new collection containing all sync plans from the original collection which are in an enabled state.

func (SyncPlans) IsOKState

func (sps SyncPlans) IsOKState() bool

IsOKState indicates whether any problems have been identified with the sync plans in this collection.

func (SyncPlans) NumDisabled

func (sps SyncPlans) NumDisabled() int

NumDisabled provides the number of sync plans in the collection in a disabled state.

func (SyncPlans) NumEnabled

func (sps SyncPlans) NumEnabled() int

NumEnabled provides the number of sync plans in the collection in an enabled state.

func (SyncPlans) NumProblemPlans

func (sps SyncPlans) NumProblemPlans() int

NumProblemPlans returns the total number of sync plans with a non-OK state.

func (SyncPlans) NumStuck

func (sps SyncPlans) NumStuck() int

NumStuck indicates the number of sync plans in the collection are in a "stuck" state.

func (SyncPlans) Stuck

func (sps SyncPlans) Stuck() SyncPlans

Stuck returns a new collection containing all sync plans from the original collection which are in a "stuck" state.

func (SyncPlans) Total

func (sps SyncPlans) Total() int

Total provides the number of sync plans in the collection.

type SyncPlansResponse

type SyncPlansResponse struct {
	Error NullString `json:"error"`

	// Search is the search string based on scoped_scoped syntax.
	Search NullString `json:"search"`

	// SyncPlans is the collection of Sync Plans returned in the API query
	// response.
	SyncPlans SyncPlans `json:"results"`

	// Sort is the optional sorting criteria for API query responses.
	Sort SortOptions `json:"sort"`

	// Subtotal is the number of objects returned with the given search
	// parameters. If there is no search, then subtotal is equal to total.
	Subtotal int `json:"subtotal"`

	// Total is the total number of objects without any search parameters.
	Total int `json:"total"`

	// Page is the page number for the current query response results.
	//
	// NOTE: In practice, this value has been found to be  returned as an
	// integer in the first response and as a string value for each additional
	// page of results. The json.Number type accepts either format when
	// decoding the response.
	Page json.Number `json:"page"`

	// PerPage is the pagination limit applied to API query results. If not
	// specified by the client this is the default value set by the API.
	PerPage int `json:"per_page"`
}

SyncPlansResponse represents the API response from a request of all sync plans for a specific organization.

https://access.redhat.com/documentation/en-us/red_hat_satellite/6.5/html-single/api_guide/index#sect-API_Guide-Understanding_the_JSON_Response_Format https://access.redhat.com/documentation/en-us/red_hat_satellite/6.15/html-single/api_guide/index#sect-API_Guide-Understanding_the_JSON_Response_Format

type SyncTime

type SyncTime time.Time

SyncTime is time value as represented in the Red Hat Satellite Sync Plans API for the next_sync and sync_date properties. It uses the SyncTimeLayout format.

func (SyncTime) Format

func (dt SyncTime) Format(layout string) string

Format calls (time.Time).Format as a convenience for the caller.

func (SyncTime) MarshalJSON

func (dt SyncTime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. This compliments the custom Unmarshaler implementation to handle conversion of a native Go time.Time format to a time value in a format that matches JSON API expectations.

func (SyncTime) String

func (dt SyncTime) String() string

String implements the fmt.Stringer interface as a convenience method.

func (*SyncTime) UnmarshalJSON

func (dt *SyncTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface to handle converting a time string from the next_sync property in the JSON API to a native Go time.Time value using the SyncTimeLayout format.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL