policies

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateURL

func CreateURL(c *gophercloud.ServiceClient) string

func GetPolicyListByResourceID

func GetPolicyListByResourceID(client *gophercloud.ServiceClient, scalingResourceId string, opts ResourceListOptsBuilder) pagination.Pager

func GetURL

func GetURL(c *gophercloud.ServiceClient, scalingPolicyId string) string

func List

func List(client *gophercloud.ServiceClient, opts ListOptsBuilder) pagination.Pager

func ListURL

func ListURL(c *gophercloud.ServiceClient, scalingResourceId string) string

func UpdateURL

func UpdateURL(c *gophercloud.ServiceClient, scalingPolicyId string) string

Types

type CreateOpts

type CreateOpts struct {
	// Specifies the AS policy name. The name can contain letters,
	// digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
	ScalingPolicyName string `json:"scaling_policy_name" required:"true"`

	// Specifies the scaling resource ID, which is the unique ID of an
	// AS group or bandwidth.
	ScalingResourceId string `json:"scaling_resource_id" required:"true"`

	// Specifies the scaling resource type.AS group:
	// SCALING_GROUP.Bandwidth: BANDWIDTH
	ScalingResourceType string `json:"scaling_resource_type" required:"true"`

	// Specifies the AS policy type.ALARM (corresponding to alarm_id):
	// indicates that the scaling action is triggered by an alarm.SCHEDULED (corresponding
	// to scheduled_policy): indicates that the scaling action is triggered as
	// scheduled.RECURRENCE (corresponding to scheduled_policy): indicates that the scaling
	// action is triggered periodically.
	ScalingPolicyType string `json:"scaling_policy_type" required:"true"`

	// Specifies the alarm rule ID. This parameter is mandatory when
	// scaling_policy_type is set to ALARM. After this parameter is specified, the value of
	// scheduled_policy does not take effect.After you create an alarm policy, the system
	// automatically adds an alarm triggering activity of the autoscaling type to the
	// alarm_actions field in the alarm rule specified by the parameter value.You can obtain
	// the parameter value by querying the CES alarm rule list. For details, see section
	// Querying Alarms in the Cloud Eye API Reference.
	AlarmId string `json:"alarm_id,omitempty"`

	// Specifies the periodic or scheduled AS policy. This parameter
	// is mandatory when scaling_policy_type is set to SCHEDULED or RECURRENCE. After this
	// parameter is specified, the value of alarm_id does not take effect.
	ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"`

	// Specifies the scaling action of the AS policy.
	ScalingPolicyAction CreateScalingPolicyAction `json:"scaling_policy_action"`

	// Specifies the cooling duration (in seconds), which is 900 by
	// default.
	CoolDownTime *int `json:"cool_down_time,omitempty"`
}

func (CreateOpts) ToPoliciesCreateMap

func (opts CreateOpts) ToPoliciesCreateMap() (map[string]interface{}, error)

type CreateOptsBuilder

type CreateOptsBuilder interface {
	ToPoliciesCreateMap() (map[string]interface{}, error)
}

type CreateResponse

type CreateResponse struct {
	// Specifies the AS policy ID.
	ScalingPolicyId string `json:"scaling_policy_id"`
}

type CreateResult

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

func Create

func Create(client *gophercloud.ServiceClient, opts CreateOptsBuilder) (r CreateResult)

func (CreateResult) Extract

func (r CreateResult) Extract() (*CreateResponse, error)

type CreateScalingPolicyAction

type CreateScalingPolicyAction struct {
	// Specifies the operation to be performed. The default operation
	// is ADD.ADD: adds specified number of instances to the AS group.REMOVE: removes
	// specified number of instances from the AS group.SET: sets the number of instances in
	// the AS group.
	Operation string `json:"operation,omitempty"`

	// Specifies the number of instances or the bandwidth. The default
	// value is 1.If scaling_resource_type is set to SCALING_GROUP, the value of this
	// parameter is the number of instances.If scaling_resource_type is set to BANDWIDTH,
	// the value of this parameter is the bandwidth (Mbit/s).Either size or percentage is
	// required.
	Size *int `json:"size,omitempty"`

	// Specifies the percentage of instances to be operated.If neither
	// instance_number nor instance_percentage is specified, the number of instances to be
	// operated is 1.Either size or percentage is required.
	Percentage *int `json:"percentage,omitempty"`

	// Specifies the operation restrictions.If scaling_resource_type
	// is set to BANDWIDTH, this parameter takes effect and the unit is Mbit/s.In this
	// case:If operation is set to ADD, this parameter indicates the maximum bandwidth.If
	// operation is set to REDUCE, this parameter indicates the minimum bandwidth.
	Limits *int `json:"limits,omitempty"`
}

type GetResponse

type GetResponse struct {
	// Specifies details about the AS policy.
	ScalingPolicy ScalingPolicy `json:"scaling_policy"`
}

type GetResult

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

func Get

func Get(client *gophercloud.ServiceClient, scalingPolicyId string) (r GetResult)

func (GetResult) Extract

func (r GetResult) Extract() (*ScalingPolicy, error)

type ListOpts

type ListOpts struct {
	// Specifies the AS policy name.
	ScalingPolicyName string `q:"scaling_policy_name"`

	// Specifies the AS policy type.
	ScalingPolicyType string `q:"scaling_policy_type"`

	// Specifies the start line number. The default value is 0.
	StartNumber int `q:"start_number"`

	// Specifies the total number of query records. The default value
	// is 20 and the maximum value is 100.
	Limit int `q:"limit"`

	// Specifies the AS policy id.
	ScalingPolicyID string `q:"scaling_policy_id"`

	ScalingResourceID   string `q:"scaling_resource_id"`
	ScalingResourceType string `q:"scaling_resource_type"`
	SortBy              string `q:"sort_by"`
	Order               string `q:"order"`
	EnterpriseProjectID string `q:"enterprise_project_id"`
}

func (ListOpts) ToListQuery

func (opts ListOpts) ToListQuery() (string, error)

type ListOptsBuilder

type ListOptsBuilder interface {
	ToListQuery() (string, error)
}

type ListResponse

type ListResponse struct {
	// Specifies the total number of query records.
	TotalNumber int `json:"total_number"`

	// Specifies the start line number.
	StartNumber int `json:"start_number"`

	// Specifies the total number of query records.
	Limit int `json:"limit"`

	// Specifies the AS policy list.
	ScalingPolicies []ScalingPolicy `json:"scaling_policies"`
}

func ExtractPolicies

func ExtractPolicies(r pagination.Page) (ListResponse, error)

ExtractPolicies is a function that takes a ListResult and returns the information.

type ListResult

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

func (ListResult) Extract

func (r ListResult) Extract() (*ListResponse, error)

type PolicyPage

type PolicyPage struct {
	pagination.NumberPageBase
}

func (PolicyPage) IsEmpty

func (r PolicyPage) IsEmpty() (bool, error)

IsEmpty returns true if a ListResult contains no services.

func (PolicyPage) LastStartNumber

func (r PolicyPage) LastStartNumber() (string, error)

LastStartNumber returns the last service in a ListResult.

type ResourceListOpts

type ResourceListOpts struct {
	// Specifies the AS policy name.
	ScalingPolicyName string `q:"scaling_policy_name"`

	// Specifies the AS policy type.
	ScalingPolicyType string `q:"scaling_policy_type"`

	// Specifies the start line number. The default value is 0.
	StartNumber int `q:"start_number"`

	// Specifies the total number of query records. The default value
	// is 20 and the maximum value is 100.
	Limit int `q:"limit"`

	// Specifies the AS policy id.
	ScalingPolicyID string `q:"scaling_policy_id"`
}

func (ResourceListOpts) ToResourceListQuery

func (opts ResourceListOpts) ToResourceListQuery() (string, error)

type ResourceListOptsBuilder

type ResourceListOptsBuilder interface {
	ToResourceListQuery() (string, error)
}

type ScalingPolicy

type ScalingPolicy struct {
	// Specifies the scaling resource ID.
	ScalingResourceId string `json:"scaling_resource_id"`

	// Specifies the scaling resource type.AS group:
	// SCALING_GROUP,Bandwidth: BANDWIDTH
	ScalingResourceType string `json:"scaling_resource_type"`

	// Specifies the AS policy name.
	ScalingPolicyName string `json:"scaling_policy_name"`

	// Specifies the AS policy ID.
	ScalingPolicyId string `json:"scaling_policy_id"`

	// Specifies the AS policy status.INSERVICE: indicates that the AS
	// policy is in use.PAUSED: indicates that the AS policy is disabled.EXECUTING: The task
	// is in process.
	PolicyStatus string `json:"policy_status"`

	// Specifies the AS policy type.ALARM: indicates that the scaling
	// action is triggered by an alarm. A value is returned for alarm_id, and no value is
	// returned for scheduled_policy.SCHEDULED: indicates that the scaling action is
	// triggered as scheduled. A value is returned for scheduled_policy, and no value is
	// returned for alarm_id, recurrence_type, recurrence_value, start_time, or
	// end_time.RECURRENCE: indicates that the scaling action is triggered periodically.
	// Values are returned for scheduled_policy, recurrence_type, recurrence_value,
	// start_time, and end_time, and no value is returned for alarm_id.
	ScalingPolicyType string `json:"scaling_policy_type"`

	// Specifies the alarm ID.
	AlarmId string `json:"alarm_id"`

	// Specifies the periodic or scheduled AS policy.
	ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"`

	// Specifies the scaling action of the AS policy.
	ScalingPolicyAction ScalingPolicyAction `json:"scaling_policy_action"`

	// Specifies the cooling duration (s).
	CoolDownTime int `json:"cool_down_time"`

	// Specifies the time when an AS policy is created. The time
	// format complies with UTC.
	CreateTime string `json:"create_time"`

	// key value metadata
	MataData map[string]interface{} `json:"meta_data"`
}

type ScalingPolicyAction

type ScalingPolicyAction struct {
	// Specifies the operation to be performed. The default operation
	// is ADD.ADD: adds specified number of instances to the AS group.REMOVE: removes
	// specified number of instances from the AS group.SET: sets the number of instances in
	// the AS group.
	Operation string `json:"operation,omitempty"`

	// Specifies the number of instances or the bandwidth. The default
	// value is 1.If scaling_resource_type is set to SCALING_GROUP, the value of this
	// parameter is the number of instances.If scaling_resource_type is set to BANDWIDTH,
	// the value of this parameter is the bandwidth (Mbit/s).Either size or percentage is
	// required.
	Size int `json:"size,omitempty"`

	// Specifies the percentage of instances to be operated.If neither
	// instance_number nor instance_percentage is specified, the number of instances to be
	// operated is 1.Either size or percentage is required.
	Percentage int `json:"percentage,omitempty"`

	// Specifies the operation restrictions.If scaling_resource_type
	// is set to BANDWIDTH, this parameter takes effect and the unit is Mbit/s.In this
	// case:If operation is set to ADD, this parameter indicates the maximum bandwidth.If
	// operation is set to REDUCE, this parameter indicates the minimum bandwidth.
	Limits int `json:"limits,omitempty"`
}

type ScheduledPolicy

type ScheduledPolicy struct {
	// Specifies the time when the scaling action is triggered. The
	// time format must comply with UTC.If scaling_policy_type is set to SCHEDULED, the time
	// format is YYYY-MM-DDThh:mmZ.If scaling_policy_type is set to RECURRENCE, the time
	// format is hh:mm.
	LaunchTime string `json:"launch_time" required:"true"`

	// Specifies the periodic triggering type. This parameter is
	// mandatory when scaling_policy_type is set to RECURRENCE.Daily: indicates that the
	// scaling action is triggered once a day.Weekly: indicates that the scaling action is
	// triggered once a week.Monthly indicates that the scaling action is triggered once a
	// month.
	RecurrenceType string `json:"recurrence_type,omitempty"`

	// Specifies the frequency at which scaling actions are
	// triggered.If recurrence_type is set to Daily, the value is null, indicating that the
	// scaling action is triggered once a day.If recurrence_type is set to Weekly, the value
	// ranges from 1 (Sunday) to 7 (Saturday). The digits refer to dates in each week and
	// separated by a comma. For example, 1,3,5.If recurrence_type is set to Monthly, the
	// value ranges from 1 to 31. The digits refer to the dates in each month and separated
	// by a comma, such as 1,10,13,28.
	RecurrenceValue string `json:"recurrence_value,omitempty"`

	// Specifies the start time of the scaling action triggered
	// periodically. The time format complies with UTC.The current time is used by
	// default.The time format is YYYY-MM-DDThh:mmZ.
	StartTime string `json:"start_time,omitempty"`

	// Specifies the end time of the scaling action triggered
	// periodically. The time format complies with UTC. This parameter is mandatory when
	// scaling_policy_type is set to RECURRENCE.When the scaling action is triggered
	// periodically, the end time cannot be earlier than the current and start time.The time
	// format is YYYY-MM-DDThh:mmZ
	EndTime string `json:"end_time,omitempty"`
}

type UpdateOpts

type UpdateOpts struct {
	// Specifies the AS policy name. The name can contain letters,
	// digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.
	ScalingPolicyName string `json:"scaling_policy_name,omitempty"`

	// Specifies the AS policy type.ALARM (corresponding to alarm_id):
	// indicates that the scaling action is triggered by an alarm.SCHEDULED (corresponding
	// to scheduled_policy): indicates that the scaling action is triggered as
	// scheduled.RECURRENCE (corresponding to scheduled_policy): indicates that the scaling
	// action is triggered periodically.
	ScalingPolicyType string `json:"scaling_policy_type,omitempty"`

	// Specifies the scaling resource ID, which is the unique ID of an
	// AS group or bandwidth.
	ScalingResourceId string `json:"scaling_resource_id,omitempty"`

	// Specifies the scaling resource type.AS group:
	// SCALING_GROUP.Bandwidth: BANDWIDTH
	ScalingResourceType string `json:"scaling_resource_type,omitempty"`

	//
	AlarmId string `json:"alarm_id,omitempty"`

	// Specifies the alarm rule ID. This parameter is mandatory when
	// scaling_policy_type is set to ALARM. After this parameter is specified, the value of
	// scheduled_policy does not take effect.After you create an alarm policy, the system
	// automatically adds an alarm triggering activity of the autoscaling type to the
	// alarm_actions field in the alarm rule specified by the parameter value.You can obtain
	// the parameter value by querying the CES alarm rule list. For details, see section
	// Querying Alarms in the Cloud Eye API Reference.
	ScheduledPolicy ScheduledPolicy `json:"scheduled_policy"`

	// Specifies the scaling action of the AS policy.
	ScalingPolicyAction ScalingPolicyAction `json:"scaling_policy_action"`

	// Specifies the cooling duration (in seconds), which is 900 by
	// default.
	CoolDownTime *int `json:"cool_down_time,omitempty"`
}

func (UpdateOpts) ToPoliciesUpdateMap

func (opts UpdateOpts) ToPoliciesUpdateMap() (map[string]interface{}, error)

type UpdateOptsBuilder

type UpdateOptsBuilder interface {
	ToPoliciesUpdateMap() (map[string]interface{}, error)
}

type UpdateResponse

type UpdateResponse struct {
	// Specifies the AS policy ID.
	ScalingPolicyId string `json:"scaling_policy_id"`
}

type UpdateResult

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

func Update

func Update(client *gophercloud.ServiceClient, scalingPolicyId string, opts UpdateOptsBuilder) (r UpdateResult)

func (UpdateResult) Extract

func (r UpdateResult) Extract() (*UpdateResponse, error)

Jump to

Keyboard shortcuts

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