service

package
v0.0.0-...-5c10511 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package service implements the XML-RPC methods specified by the AM API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindCredential

func FindCredential(
	userIdentifier identifiers.Identifier,
	targetIdentifier *identifiers.Identifier,
	credentials []Credential,
	trustedCertificates [][]byte,
) (*sfa.Credential, error)

func FindCredentialForSliver

func FindCredentialForSliver(
	userIdentifier identifiers.Identifier,
	sliver v1.Sliver,
	credentials []Credential,
	trustedCertificates [][]byte,
) (*sfa.Credential, error)

func MarshalRspec

func MarshalRspec(rspec rspec.Rspec, compressed bool) (string, error)

Types

type APIVersions

type APIVersions struct {
	Three string `xml:"3"`
}

type AllocateArgs

type AllocateArgs struct {
	SliceURN    string
	Credentials []Credential
	Rspec       string
	Options     Options
}

type AllocateReply

type AllocateReply struct {
	Data struct {
		Code   Code   `xml:"code"`
		Output string `xml:"output"`
		Value  struct {
			Rspec   string   `xml:"geni_rspec"`
			Slivers []Sliver `xml:"geni_slivers"`
		} `xml:"value"`
	}
}

func (*AllocateReply) SetAndLogError

func (v *AllocateReply) SetAndLogError(err error, msg string, keysAndValues ...interface{}) error

type Code

type Code struct {
	// An integer supplying the GENI standard return code indicating the success or failure of this call.
	// Error codes are standardized and defined in
	// https://groups.geni.net/geni/attachment/wiki/GAPI_AM_API_V3/CommonConcepts/geni-error-codes.xml.
	// Codes may be negative. A success return is defined as geni_code of 0.
	Code int `xml:"geni_code"`
}

type Credential

type Credential struct {
	Type    string `xml:"geni_type"`
	Version string `xml:"geni_version"`
	Value   string `xml:"geni_value"`
}

func (Credential) ValidatedSFA

func (c Credential) ValidatedSFA(trustedCertificates [][]byte) (*sfa.Credential, error)

type CredentialType

type CredentialType struct {
	Type    string `xml:"geni_type"`
	Version string `xml:"geni_version"`
}

type DeleteArgs

type DeleteArgs struct {
	URNs        []string
	Credentials []Credential
	Options     Options
}

type DeleteReply

type DeleteReply struct {
	Data struct {
		Code   Code     `xml:"code"`
		Output string   `xml:"output"`
		Value  []Sliver `xml:"value"`
	}
}

func (*DeleteReply) SetAndLogError

func (v *DeleteReply) SetAndLogError(err error, msg string, keysAndValues ...interface{}) error

type DescribeArgs

type DescribeArgs struct {
	URNs        []string
	Credentials []Credential
	Options     Options
}

type DescribeReply

type DescribeReply struct {
	Data struct {
		Code   Code   `xml:"code"`
		Output string `xml:"output"`
		Value  struct {
			Rspec   string   `xml:"geni_rspec"`
			URN     string   `xml:"geni_urn"`
			Slivers []Sliver `xml:"geni_slivers"`
		} `xml:"value"`
	}
}

func (*DescribeReply) SetAndLogError

func (v *DescribeReply) SetAndLogError(err error, msg string, keysAndValues ...interface{}) error

type GetVersionArgs

type GetVersionArgs struct{}

type GetVersionReply

type GetVersionReply struct {
	Data struct {
		API   int  `xml:"geni_api"`
		Code  Code `xml:"code"`
		Value struct {
			URN string `xml:"urn"`
			// Current version of this API.
			API int `xml:"geni_api"`
			// List of versions of the API supported by this aggregate.
			APIVersions APIVersions `xml:"geni_api_versions"`
			// List of request RSpec formats supported by this aggregate.
			RequestRspecVersions []RspecVersion `xml:"geni_request_rspec_versions"`
			// List of advertisement RSpec formats supported by this aggregate.
			AdRspecVersions []RspecVersion `xml:"geni_ad_rspec_versions"`
			// List of supported credential types and versions.
			CredentialTypes []CredentialType `xml:"geni_credential_types"`
			// When true (not default), and performing one of (Describe, Allocate, Renew, Provision, Delete),
			// such an AM requires you to include either the slice urn or the urn of all the slivers in the same state.
			// If you attempt to run one of those operations on just some slivers in a given state,
			// such an AM will return an error.
			SingleAllocation int `xml:"geni_single_allocation"`
			// Defines whether this AM allows adding slivers to slices at an AM.
			Allocate string `xml:"geni_allocate"`
		} `xml:"value"`
	}
}

type ListResourcesArgs

type ListResourcesArgs struct {
	Credentials []Credential
	Options     Options
}

type ListResourcesReply

type ListResourcesReply struct {
	Data struct {
		Code   Code   `xml:"code"`
		Output string `xml:"output"`
		Value  string `xml:"value"`
	}
}

func (*ListResourcesReply) SetAndLogError

func (v *ListResourcesReply) SetAndLogError(
	err error,
	msg string,
	code int,
	keysAndValues ...interface{},
) error

type Options

type Options struct {
	// XML-RPC boolean value indicating whether the caller is interested in
	// all resources or available resources.
	// If this value is true (1), the result should contain only available resources.
	// If this value is false (0) or unspecified, both available and allocated resources should be returned.
	// The Aggregate Manager is free to limit visibility of certain resources based on the credentials parameter.
	Available  bool `xml:"geni_available"`
	BestEffort bool `xml:"geni_best_effort"`
	// XML-RPC boolean value indicating whether the caller would like the result to be compressed.
	// If the value is true (1), the returned resource list will be compressed according to RFC 1950.
	// If the value is false (0) or unspecified, the return will be text.
	Compressed bool `xml:"geni_compressed"`
	// Requested expiration of all new slivers, may be ignored by aggregates.
	EndTime string `xml:"geni_end_time"`
	// XML-RPC struct indicating the type and version of Advertisement RSpec to return.
	// The struct contains 2 members, type and version. type and version are case-insensitive strings,
	// matching those in geni_ad_rspec_versions as returned by GetVersion at this aggregate.
	// This option is required, and aggregates are expected to return a geni_code of 1 (BADARGS) if it is missing.
	// Aggregates should return a geni_code of 4 (BADVERSION) if the requested RSpec version
	// is not one advertised as supported in GetVersion.
	RspecVersion RspecVersion `xml:"geni_rspec_version"`
	Users        []struct {
		URN  string   `xml:"urn"`
		Keys []string `xml:"keys"`
	} `xml:"geni_users"`
}

type PerformOperationalActionArgs

type PerformOperationalActionArgs struct {
	URNs        []string
	Credentials []Credential
	Action      string
	Options     Options
}

type PerformOperationalActionReply

type PerformOperationalActionReply struct {
	Data struct {
		Code   Code     `xml:"code"`
		Output string   `xml:"output"`
		Value  []Sliver `xml:"value"`
	}
}

func (*PerformOperationalActionReply) SetAndLogError

func (v *PerformOperationalActionReply) SetAndLogError(
	err error,
	msg string,
	keysAndValues ...interface{},
) error

type ProvisionArgs

type ProvisionArgs struct {
	URNs        []string
	Credentials []Credential
	Options     Options
}

type ProvisionReply

type ProvisionReply struct {
	Data struct {
		Code   Code   `xml:"code"`
		Output string `xml:"output"`
		Value  struct {
			Rspec   string   `xml:"geni_rspec"`
			Slivers []Sliver `xml:"geni_slivers"`
		} `xml:"value"`
	}
}

func (*ProvisionReply) SetAndLogError

func (v *ProvisionReply) SetAndLogError(err error, msg string, keysAndValues ...interface{}) error

type RenewArgs

type RenewArgs struct {
	URNs           []string
	Credentials    []Credential
	ExpirationTime string
	Options        Options
}

type RenewReply

type RenewReply struct {
	Data struct {
		Code   Code     `xml:"code"`
		Output string   `xml:"output"`
		Value  []Sliver `xml:"value"`
	}
}

func (*RenewReply) SetAndLogError

func (v *RenewReply) SetAndLogError(err error, msg string, keysAndValues ...interface{}) error

type RspecVersion

type RspecVersion struct {
	Type       string   `xml:"type"`
	Version    string   `xml:"version"`
	Schema     string   `xml:"schema"`
	Namespace  string   `xml:"namespace"`
	Extensions []string `xml:"extensions"`
}

type Service

type Service struct {
	AbsoluteURL          string
	AuthorityIdentifier  identifiers.Identifier
	ContainerImages      map[string]string
	ContainerCpuLimit    string
	ContainerMemoryLimit string
	NamespaceCpuLimit    string
	NamespaceMemoryLimit string
	Namespace            string
	TrustedCertificates  [][]byte
	Fed4FireClient       versioned.Interface
	KubernetesClient     kubernetes.Interface
}

func (*Service) Allocate

func (s *Service) Allocate(r *http.Request, args *AllocateArgs, reply *AllocateReply) error

Allocate allocates resources as described in a request RSpec argument to a slice with the named URN. On success, one or more slivers are allocated, containing resources satisfying the request, and assigned to the given slice. This method returns a listing and description of the resources reserved for the slice by this operation, in the form of a manifest RSpec. https://groups.geni.net/geni/wiki/GAPI_AM_API_V3#Allocate

func (Service) AuthorizeAndListSlivers

func (s Service) AuthorizeAndListSlivers(
	r *http.Request,
	resourceIdentifiersStr []string,
	credentials []Credential,
) ([]v1.Sliver, error)

func (Service) ConfigMaps

func (s Service) ConfigMaps() typedcorev1.ConfigMapInterface

func (*Service) Delete

func (s *Service) Delete(r *http.Request, args *DeleteArgs, reply *DeleteReply) error

Delete deletes the named slivers, making them geni_unallocated. Resources are stopped if necessary, and both de-provisioned and de-allocated. No further AM API operations may be performed on slivers that have been deleted. https://groups.geni.net/geni/wiki/GAPI_AM_API_V3#Delete

func (Service) Deployments

func (s Service) Deployments() typedappsv1.DeploymentInterface

func (*Service) Describe

func (s *Service) Describe(r *http.Request, args *DescribeArgs, reply *DescribeReply) error

Describe retrieves a manifest RSpec describing the resources contained by the named entities, e.g. a single slice or a set of the slivers in a slice. This listing and description should be sufficiently descriptive to allow experimenters to use the resources.

func (Service) GetSliver

func (s Service) GetSliver(ctx context.Context, name string) *v1.Sliver

func (Service) GetSliverArchHostPort

func (s Service) GetSliverArchHostPort(ctx context.Context, name string) (*string, *string, *int)

func (Service) GetSliverDeployment

func (s Service) GetSliverDeployment(ctx context.Context, name string) *appsv1.Deployment

func (Service) GetSliverStatus

func (s Service) GetSliverStatus(ctx context.Context, name string) (string, string)

func (*Service) GetVersion

func (s *Service) GetVersion(r *http.Request, args *GetVersionArgs, reply *GetVersionReply) error

GetVersion returns static configuration information about this aggregate manager implementation, such as API and RSpec versions supported. https://groups.geni.net/geni/wiki/GAPI_AM_API_V3#GetVersion

func (*Service) ListResources

func (s *Service) ListResources(
	r *http.Request,
	args *ListResourcesArgs,
	reply *ListResourcesReply,
) error

ListResources returns a listing and description of available resources at this aggregate. The resource listing and description provides sufficient information for clients to select among available resources. These listings are known as advertisement RSpecs. https://groups.geni.net/geni/wiki/GAPI_AM_API_V3#ListResources

func (Service) ListSlivers

func (s Service) ListSlivers(
	ctx context.Context,
	identifier identifiers.Identifier,
) ([]v1.Sliver, error)

func (Service) Nodes

func (s Service) Nodes() typedcorev1.NodeInterface

func (*Service) PerformOperationalAction

func (s *Service) PerformOperationalAction(
	r *http.Request,
	args *PerformOperationalActionArgs,
	reply *PerformOperationalActionReply,
) error

PerformOperationalAction performs the named operational action on the named slivers, possibly changing the geni_operational_status of the named slivers, e.g. 'start' a VM. For valid operations and expected states, consult the state diagram advertised in the aggregate's advertisement RSpec.

func (Service) Pods

func (s Service) Pods() typedcorev1.PodInterface

func (*Service) Provision

func (s *Service) Provision(r *http.Request, args *ProvisionArgs, reply *ProvisionReply) error

Provision requests that the named geni_allocated slivers be made geni_provisioned, instantiating or otherwise realizing the resources, such that they have a valid geni_operational_status and may be made geni_ready for experimenter use. https://groups.geni.net/geni/wiki/GAPI_AM_API_V3#Provision

func (*Service) Renew

func (s *Service) Renew(r *http.Request, args *RenewArgs, reply *RenewReply) error

Renew the named slivers renewed, with their expiration extended. If possible, the aggregate should extend the slivers to the requested expiration time, or to a sooner time if policy limits apply. This method applies to slivers that are geni_allocated or to slivers that are geni_provisioned, though different policies may apply to slivers in the different states, resulting in much shorter max expiration times for geni_allocated slivers.

func (Service) Services

func (s Service) Services() typedcorev1.ServiceInterface

func (*Service) Shutdown

func (s *Service) Shutdown(r *http.Request, args *ShutdownArgs, reply *ShutdownReply) error

Shutdown performs an emergency shutdown on the slivers in the given slice at this aggregate. Resources should be taken offline, such that experimenter access (on both the control and data plane) is cut off. No further actions on the slivers in the given slice should be possible at this aggregate, until an un-specified operator action restores the slice's slivers (or deletes them). This operation is intended for operator use. The slivers are shut down but remain available for further forensics.

func (Service) Slivers

func (s Service) Slivers() fed4firev1.SliverInterface

func (*Service) Status

func (s *Service) Status(r *http.Request, args *StatusArgs, reply *StatusReply) error

Status gets the status of a sliver or slivers belonging to a single slice at the given aggregate. Status may include other dynamic reservation or instantiation information as required by the resource type and aggregate. This method is used to provide updates on the state of the resources after the completion of Provision, which began to asynchronously provision the resources. This should be relatively dynamic data, not descriptive data as returned in the manifest RSpec.

type ShutdownArgs

type ShutdownArgs struct {
	SliceURN    string
	Credentials []Credential
	Options     Options
}

type ShutdownReply

type ShutdownReply struct {
	Data struct {
		Code  Code     `xml:"code"`
		Value []Sliver `xml:"value"`
	}
}

type Sliver

type Sliver struct {
	URN               string `xml:"geni_sliver_urn"`
	Expires           string `xml:"geni_expires"`
	AllocationStatus  string `xml:"geni_allocation_status"`
	OperationalStatus string `xml:"geni_operational_status"`
	Error             string `xml:"geni_error"`
}

func NewSliver

func NewSliver(sliver v1.Sliver, allocationStatus string, operationalStatus string) Sliver

type StatusArgs

type StatusArgs struct {
	URNs        []string
	Credentials []Credential
	Options     Options
}

type StatusReply

type StatusReply struct {
	Data struct {
		Code   Code   `xml:"code"`
		Output string `xml:"output"`
		Value  struct {
			URN     string   `xml:"geni_urn"`
			Slivers []Sliver `xml:"geni_slivers"`
		} `xml:"value"`
	}
}

func (*StatusReply) SetAndLogError

func (v *StatusReply) SetAndLogError(err error, msg string, keysAndValues ...interface{}) error

Jump to

Keyboard shortcuts

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