zpu

package
v1.7.40 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 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

Overview

Package zpu is a utility library to update ZPE Policy.

Index

Constants

View Source
const (
	DEFAULT_STARTUP_DELAY = 0
	MAX_STARTUP_DELAY     = 1440
	DEFAULT_EXPIRY_CHECK  = 2880
)

Default and maximal startup delay values.

Variables

This section is empty.

Functions

func GetEtagForExistingPolicy

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

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
	ExpiryCheck      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
tools
Tools is a program that runs zpu.PolicyUpdater.
Tools is a program that runs zpu.PolicyUpdater.
Package devel provides utility functions for testing (StartMockServer and CreateFile).
Package devel provides utility functions for testing (StartMockServer and CreateFile).
Package test_data contains test data packed as Go files.
Package test_data contains test data packed as Go files.
Package util provides utility types and functions for zpe-updater.
Package util provides utility types and functions for zpe-updater.

Jump to

Keyboard shortcuts

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