<commit_before>/*
// Copyright (c) 2016 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/

package payloads

import (
	"time"
)

// PrivateAddresses contains information about a single instance network
// interface.
type PrivateAddresses struct {
	Addr               string `json:"addr"`
	OSEXTIPSMACMacAddr string `json:"OS-EXT-IPS-MAC:mac_addr"`
	OSEXTIPSType       string `json:"OS-EXT-IPS:type"`
	Version            int    `json:"version"`
}

// Addresses contains information about an instance's networks.
type Addresses struct {
	Private []PrivateAddresses `json:"private"`
}

// Link is reserved for future use.
type Link struct {
	Href string `json:"href"`
	Rel  string `json:"rel"`
}

// Flavor identifies the flavour (workload) of an instance.
type Flavor struct {
	ID    string `json:"id"`
	Links []Link `json:"links"`
}

// Image identifies the base image of the instance.
type Image struct {
	ID    string `json:"id"`
	Links []Link `json:"links"`
}

// SecurityGroup represents the security group of an instance.
type SecurityGroup struct {
	Name string `json:"name"`
}

const (
	// ComputeStatusPending is a filter that used to select pending
	// instances in requests to the controller.
	ComputeStatusPending = "pending"

	// ComputeStatusRunning is a filter that used to select running
	// instances in requests to the controller.
	ComputeStatusRunning = "running"

	// ComputeStatusStopped is a filter that used to select exited
	// instances in requests to the controller.
	ComputeStatusStopped = "exited"
)

// Server contains information about a specific instance within a ciao cluster.
type Server struct {
	Addresses                        Addresses       `json:"addresses"`
	Created                          time.Time       `json:"created"`
	Flavor                           Flavor          `json:"flavor"`
	HostID                           string          `json:"hostId"`
	ID                               string          `json:"id"`
	Image                            Image           `json:"image"`
	KeyName                          string          `json:"key_name"`
	Links                            []Link          `json:"links"`
	Name                             string          `json:"name"`
	AccessIPv4                       string          `json:"accessIPv4"`
	AccessIPv6                       string          `json:"accessIPv6"`
	ConfigDrive                      string          `json:"config_drive"`
	OSDCFDiskConfig                  string          `json:"OS-DCF:diskConfig"`
	OSEXTAZAvailabilityZone          string          `json:"OS-EXT-AZ:availability_zone"`
	OSEXTSRVATTRHost                 string          `json:"OS-EXT-SRV-ATTR:host"`
	OSEXTSRVATTRHypervisorHostname   string          `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"`
	OSEXTSRVATTRInstanceName         string          `json:"OS-EXT-SRV-ATTR:instance_name"`
	OSEXTSTSPowerState               int             `json:"OS-EXT-STS:power_state"`
	OSEXTSTSTaskState                string          `json:"OS-EXT-STS:task_state"`
	OSEXTSTSVMState                  string          `json:"OS-EXT-STS:vm_state"`
	OsExtendedVolumesVolumesAttached []string        `json:"os-extended-volumes:volumes_attached"`
	OSSRVUSGLaunchedAt               time.Time       `json:"OS-SRV-USG:launched_at"`
	OSSRVUSGTerminatedAt             time.Time       `json:"OS-SRV-USG:terminated_at"`
	Progress                         int             `json:"progress"`
	SecurityGroups                   []SecurityGroup `json:"security_groups"`
	Status                           string          `json:"status"`
	HostStatus                       string          `json:"host_status"`
	TenantID                         string          `json:"tenant_id"`
	Updated                          time.Time       `json:"updated"`
	UserID                           string          `json:"user_id"`
	SSHIP                            string          `json:"ssh_ip"`
	SSHPort                          int             `json:"ssh_port"`
}

// ComputeServers represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/servers/detail response.  It contains information about a
// set of instances within a ciao cluster.
type ComputeServers struct {
	TotalServers int      `json:"total_servers"`
	Servers      []Server `json:"servers"`
}

// ComputeServer represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/servers/{server} response.  It contains information about a
// specific instance within a ciao cluster.
type ComputeServer struct {
	Server Server `json:"server"`
}

// ComputeFlavors represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/flavors response.  It contains information about all the
// flavors in a cluster.
type ComputeFlavors struct {
	Flavors []struct {
		ID    string `json:"id"`
		Links []Link `json:"links"`
		Name  string `json:"name"`
	} `json:"flavors"`
}

// FlavorDetails contains information about a specific flavor.
type FlavorDetails struct {
	OSFLVDISABLEDDisabled  bool   `json:"OS-FLV-DISABLED:disabled"`
	Disk                   string `json:"disk"` /* OpenStack API says this is an int */
	OSFLVEXTDATAEphemeral  int    `json:"OS-FLV-EXT-DATA:ephemeral"`
	OsFlavorAccessIsPublic bool   `json:"os-flavor-access:is_public"`
	ID                     string `json:"id"`
	Links                  []Link `json:"links"`
	Name                   string `json:"name"`
	RAM                    int    `json:"ram"`
	Swap                   string `json:"swap"`
	Vcpus                  int    `json:"vcpus"`
}

// ComputeFlavorDetails represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/flavors/{flavor} response.  It contains information about a
// specific flavour.
type ComputeFlavorDetails struct {
	Flavor FlavorDetails `json:"flavor"`
}

// ComputeFlavorsDetails represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/flavors/detail response. It contains detailled information about
// all flavour for a given tenant.
type ComputeFlavorsDetails struct {
	Flavors []FlavorDetails `json:"flavors"`
}

// ComputeCreateServer represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/servers request.  It contains the information needed to start
// one or more instances.
type ComputeCreateServer struct {
	Server struct {
		Name         string `json:"name"`
		Image        string `json:"imageRef"`
		Workload     string `json:"flavorRef"`
		MaxInstances int    `json:"max_count"`
		MinInstances int    `json:"min_count"`
	} `json:"server"`<commit_msg>payloads: Fix misspelling<commit_after>/*
// Copyright (c) 2016 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
*/

package payloads

import (
	"time"
)

// PrivateAddresses contains information about a single instance network
// interface.
type PrivateAddresses struct {
	Addr               string `json:"addr"`
	OSEXTIPSMACMacAddr string `json:"OS-EXT-IPS-MAC:mac_addr"`
	OSEXTIPSType       string `json:"OS-EXT-IPS:type"`
	Version            int    `json:"version"`
}

// Addresses contains information about an instance's networks.
type Addresses struct {
	Private []PrivateAddresses `json:"private"`
}

// Link is reserved for future use.
type Link struct {
	Href string `json:"href"`
	Rel  string `json:"rel"`
}

// Flavor identifies the flavour (workload) of an instance.
type Flavor struct {
	ID    string `json:"id"`
	Links []Link `json:"links"`
}

// Image identifies the base image of the instance.
type Image struct {
	ID    string `json:"id"`
	Links []Link `json:"links"`
}

// SecurityGroup represents the security group of an instance.
type SecurityGroup struct {
	Name string `json:"name"`
}

const (
	// ComputeStatusPending is a filter that used to select pending
	// instances in requests to the controller.
	ComputeStatusPending = "pending"

	// ComputeStatusRunning is a filter that used to select running
	// instances in requests to the controller.
	ComputeStatusRunning = "running"

	// ComputeStatusStopped is a filter that used to select exited
	// instances in requests to the controller.
	ComputeStatusStopped = "exited"
)

// Server contains information about a specific instance within a ciao cluster.
type Server struct {
	Addresses                        Addresses       `json:"addresses"`
	Created                          time.Time       `json:"created"`
	Flavor                           Flavor          `json:"flavor"`
	HostID                           string          `json:"hostId"`
	ID                               string          `json:"id"`
	Image                            Image           `json:"image"`
	KeyName                          string          `json:"key_name"`
	Links                            []Link          `json:"links"`
	Name                             string          `json:"name"`
	AccessIPv4                       string          `json:"accessIPv4"`
	AccessIPv6                       string          `json:"accessIPv6"`
	ConfigDrive                      string          `json:"config_drive"`
	OSDCFDiskConfig                  string          `json:"OS-DCF:diskConfig"`
	OSEXTAZAvailabilityZone          string          `json:"OS-EXT-AZ:availability_zone"`
	OSEXTSRVATTRHost                 string          `json:"OS-EXT-SRV-ATTR:host"`
	OSEXTSRVATTRHypervisorHostname   string          `json:"OS-EXT-SRV-ATTR:hypervisor_hostname"`
	OSEXTSRVATTRInstanceName         string          `json:"OS-EXT-SRV-ATTR:instance_name"`
	OSEXTSTSPowerState               int             `json:"OS-EXT-STS:power_state"`
	OSEXTSTSTaskState                string          `json:"OS-EXT-STS:task_state"`
	OSEXTSTSVMState                  string          `json:"OS-EXT-STS:vm_state"`
	OsExtendedVolumesVolumesAttached []string        `json:"os-extended-volumes:volumes_attached"`
	OSSRVUSGLaunchedAt               time.Time       `json:"OS-SRV-USG:launched_at"`
	OSSRVUSGTerminatedAt             time.Time       `json:"OS-SRV-USG:terminated_at"`
	Progress                         int             `json:"progress"`
	SecurityGroups                   []SecurityGroup `json:"security_groups"`
	Status                           string          `json:"status"`
	HostStatus                       string          `json:"host_status"`
	TenantID                         string          `json:"tenant_id"`
	Updated                          time.Time       `json:"updated"`
	UserID                           string          `json:"user_id"`
	SSHIP                            string          `json:"ssh_ip"`
	SSHPort                          int             `json:"ssh_port"`
}

// ComputeServers represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/servers/detail response.  It contains information about a
// set of instances within a ciao cluster.
type ComputeServers struct {
	TotalServers int      `json:"total_servers"`
	Servers      []Server `json:"servers"`
}

// ComputeServer represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/servers/{server} response.  It contains information about a
// specific instance within a ciao cluster.
type ComputeServer struct {
	Server Server `json:"server"`
}

// ComputeFlavors represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/flavors response.  It contains information about all the
// flavors in a cluster.
type ComputeFlavors struct {
	Flavors []struct {
		ID    string `json:"id"`
		Links []Link `json:"links"`
		Name  string `json:"name"`
	} `json:"flavors"`
}

// FlavorDetails contains information about a specific flavor.
type FlavorDetails struct {
	OSFLVDISABLEDDisabled  bool   `json:"OS-FLV-DISABLED:disabled"`
	Disk                   string `json:"disk"` /* OpenStack API says this is an int */
	OSFLVEXTDATAEphemeral  int    `json:"OS-FLV-EXT-DATA:ephemeral"`
	OsFlavorAccessIsPublic bool   `json:"os-flavor-access:is_public"`
	ID                     string `json:"id"`
	Links                  []Link `json:"links"`
	Name                   string `json:"name"`
	RAM                    int    `json:"ram"`
	Swap                   string `json:"swap"`
	Vcpus                  int    `json:"vcpus"`
}

// ComputeFlavorDetails represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/flavors/{flavor} response.  It contains information about a
// specific flavour.
type ComputeFlavorDetails struct {
	Flavor FlavorDetails `json:"flavor"`
}

// ComputeFlavorsDetails represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/flavors/detail response. It contains detailed information about
// all flavour for a given tenant.
type ComputeFlavorsDetails struct {
	Flavors []FlavorDetails `json:"flavors"`
}

// ComputeCreateServer represents the unmarshalled version of the contents of a
// /v2.1/{tenant}/servers request.  It contains the information needed to start
// one or more instances.
type ComputeCreateServer struct {
	Server struct {
		Name         string `json:"name"`
		Image        string `json:"imageRef"`
		Workload     string `json:"flavorRef"`
		MaxInstances int    `json:"max_count"`
		MinInstances int    `json:"min_count"`
	} `json:"server"`
{'fraction_non_alphanumeric': 0.09453439864243796, 'fraction_numerical': 0.003393905112069575, 'mean_word_length': 2.3116366190587683, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6569976', 'n_tokens_mistral': 3939, 'n_tokens_neox': 3804, 'n_words': 1189}