zpu

package
v1.7.25 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

README

ZPE Policy Updater GO utility

License

Copyright 2017 Yahoo Holdings, Inc.

Licensed under the terms of the Apache version 2.0 license. See LICENSE file for terms.

Documentation

Index

Constants

View Source
const (
	DEFAULT_STARTUP_DELAY = 0
	MAX_STARTUP_DELAY     = 86400
)

Variables

This section is empty.

Functions

func GetEtagForExistingPolicy

func GetEtagForExistingPolicy(config *ZpuConfiguration, ztsClient zts.ZTSClient, domain, policyFileDir string) (string, error)

func GetPolicies

func GetPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, policyFileDir, domain string) error

func PolicyUpdater

func PolicyUpdater(config *ZpuConfiguration) error

func PostAllDomainMetric

func PostAllDomainMetric(ztsClient zts.ZTSClient, metricFilePath string) error

func ValidateSignedPolicies

func ValidateSignedPolicies(config *ZpuConfiguration, ztsClient zts.ZTSClient, data *zts.DomainSignedPolicyData) error

func WritePolicies

func WritePolicies(config *ZpuConfiguration, data *zts.DomainSignedPolicyData, domain, policyFileDir string) error

If domain policy file is not found, create the policy file and write policies in it else delete the existing file and write the modified policies to new file

Types

type AthenzConf

type AthenzConf struct {
	ZtsUrl        string `json:"ztsUrl"`
	ZmsUrl        string `json:"zmsUrl"`
	ZtsPublicKeys []struct {
		Id  string `json:"id"`
		Key string `json:"key"`
	} `json:"ztsPublicKeys"`
	ZmsPublicKeys []struct {
		Id  string `json:"id"`
		Key string `json:"key"`
	} `json:"zmsPublicKeys"`
}

func ReadAthenzConf

func ReadAthenzConf(athenzConf string) (*AthenzConf, error)

type ZpuConf

type ZpuConf struct {
	Domains       string `json:"domains"`
	User          string `json:"user"`
	PolicyDir     string `json:"policyDir"`
	MetricsDir    string `json:"metricsDir"`
	LogMaxSize    int    `json:"logMaxsize"`
	LogMaxAge     int    `json:"logMaxage"`
	LogMaxBackups int    `json:"logMaxbackups"`
	LogCompress   bool   `json:"logCompress"`
}

func ReadZpuConf

func ReadZpuConf(zpuConf string) (*ZpuConf, error)

type ZpuConfiguration

type ZpuConfiguration struct {
	Zts              string
	Zms              string
	DomainList       string
	ZpuOwner         string
	PolicyFileDir    string
	TmpPolicyFileDir string
	MetricsDir       string
	ZmsKeysmap       map[string]string
	ZtsKeysmap       map[string]string
	StartUpDelay     int
	LogSize          int
	LogAge           int
	LogBackups       int
	LogCompression   bool
}

func NewZpuConfiguration

func NewZpuConfiguration(root, athensConfFile, zpuConfFile, tmpPolicyFileDir string) (*ZpuConfiguration, error)

func (ZpuConfiguration) GetZmsPublicKey

func (config ZpuConfiguration) GetZmsPublicKey(key string) string

func (ZpuConfiguration) GetZtsPublicKey

func (config ZpuConfiguration) GetZtsPublicKey(key string) string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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