httprelation

package
v0.0.0-...-c60bc85 Latest Latest
Warning

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

Go to latest
Published: May 19, 2017 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

The httprelation package can be used in a charm that uses a relation with interface type "http".

Index

Constants

This section is empty.

Variables

View Source
var ErrHTTPSNotConfigured = errgo.New("HTTPS not configured")

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider represents the provider of an http relation.

func (*Provider) HTTPPort

func (p *Provider) HTTPPort() int

HTTPPort returns the configured port of the HTTP server. If the port has not been set, it returns 0.

func (*Provider) HTTPSPort

func (p *Provider) HTTPSPort() int

HTTPPort returns the configured port of the HTTP server. If the port has not been set, it returns 0.

func (*Provider) Register

func (p *Provider) Register(r *hook.Registry, relationName string, allowHTTPS bool)

Register registers everything necessary on r for running the provider side of an http relation with the given relation name.

It takes care of opening and closing the configured port, but does not actually start the HTTP handler server. If changed is not nil, it notifies that the port has changed by calling changed.HTTPServerPortChanged.

The port of the server is configured with the "server-port" charm configuration option.

func (*Provider) TLSCertPEM

func (p *Provider) TLSCertPEM() (string, error)

TLSCertPEM returns the currently configured server certificate in PEM format. It returns ErrHTTPSNotConfigured if there is no currently configured certificate.

type Requirer

type Requirer struct {
	// contains filtered or unexported fields
}

Requirer represents the requirer of an http relation.

func (*Requirer) Register

func (req *Requirer) Register(r *hook.Registry, relationName string)

Register registers everything necessary on r for running the provider side of an http relation with the given relation name.

func (*Requirer) URLs

func (req *Requirer) URLs() []string

URLs returns the URLs of all the provider units.

Jump to

Keyboard shortcuts

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