awx

package module
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2020 License: MIT Imports: 12 Imported by: 1

README

awx-go

Build Status Go Report Card codecov

AWX SDK for the Go programming language.

AWX-GO-ROBOT

Installing

If you are using Go 1.5 with the GO15VENDOREXPERIMENT=1 vendoring flag, or 1.6 and higher you can use the following command to retrieve the SDK. The SDK will be included.

go get -u github.com/davidfischer-ch/awx-go

Example

We can simply import awx-go and call its services, such as PingService:

import (
    "log"
    awxGo "github.com/davidfischer-ch/awx-go"
)

func main() {
    awx := awxGo.NewAWX("http://awx.your_server_host.com", "your_awx_username", "your_awx_passwd", nil)
    result, err := awx.PingService.Ping()
    if err != nil {
        log.Fatalf("Ping awx err: %s", err)
    }

    log.Println("Ping awx: ", result)
}

More examples can be found at here.

Roadmap

awx-go is still in development, and its roadmap could be found at here.

Contribute

There are many ways to contribute to awx-go.

Documentation

Index

Constants

View Source
const (
	JobStatusNew        = "new"
	JobStatusPending    = "pending"
	JobStatusWaiting    = "waiting"
	JobStatusRunning    = "running"
	JobStatusSuccessful = "successful"
	JobStatusFailed     = "failed"
	JobStatusError      = "error"
	JobStatusCanceled   = "canceled"
)

Enum of job statuses.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(resp *http.Response) error

CheckResponse do http response check, and return err if not in [200, 300).

func ValidateParams added in v0.0.3

func ValidateParams(data map[string]interface{}, mandatoryFields []string) (notfound []string, status bool)

ValidateParams is to validate the input to use the services.

Types

type APIRequest

type APIRequest struct {
	Method   string
	Endpoint string
	Payload  io.Reader
	Headers  http.Header
	Suffix   string
}

APIRequest represents the http api communication way.

func NewAPIRequest

func NewAPIRequest(method string, endpoint string, payload io.Reader) *APIRequest

NewAPIRequest news an APIRequest object.

func (*APIRequest) SetHeader

func (ar *APIRequest) SetHeader(key string, value string) *APIRequest

SetHeader sets http header by passing k,v.

type AWX

type AWX struct {
	PingService           *PingService
	InventoriesService    *InventoriesService
	JobService            *JobService
	JobTemplateService    *JobTemplateService
	ProjectService        *ProjectService
	ProjectUpdatesService *ProjectUpdatesService
	UserService           *UserService
	GroupService          *GroupService
	HostService           *HostService
	OrganizationService   *OrganizationService
	TeamService           *TeamService
	// contains filtered or unexported fields
}

AWX represents awx api endpoints with services, and using client to communicate with awx server.

func NewAWX

func NewAWX(baseURL, userName, passwd string, client *http.Client) *AWX

NewAWX news an awx handler with basic auth support, you could customize the http transport by passing custom client.

type AssociateGroup added in v0.0.3

type AssociateGroup struct {
	ID        int  `json:"id"`
	Associate bool `json:"associate"`
}

AssociateGroup implement the awx group association request

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

BasicAuth represents http basic auth.

type ByUserSummary

type ByUserSummary struct {
	ID        int    `json:"id"`
	Username  string `json:"username"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
}

ByUserSummary represents the awx api user summary fields.

type CancelJobResponse

type CancelJobResponse struct {
	Detail string `json:"detail"`
}

CancelJobResponse represents `CancelJob` endpoint response.

type Client

type Client struct {
	BaseURL   string
	Requester *Requester
}

Client implement http client.

type Credential

type Credential struct {
	Description      string `json:"description"`
	CredentialTypeID int    `json:"credential_type_id"`
	ID               int    `json:"id"`
	Kind             string `json:"kind"`
	Name             string `json:"name"`
}

Credential represents the awx api credential.

type CredentialService added in v0.0.3

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

CredentialService implements awx Credentials apis.

func (*CredentialService) CreateCredential added in v0.0.3

func (t *CredentialService) CreateCredential(data map[string]interface{}, params map[string]string) (*Credential, error)

CreateCredential creates an awx Credential.

func (*CredentialService) DeleteCredential added in v0.0.3

func (t *CredentialService) DeleteCredential(id int) (*Credential, error)

DeleteCredential delete an awx Credential.

func (*CredentialService) ListCredentials added in v0.0.3

func (t *CredentialService) ListCredentials(params map[string]string) ([]*Credential, *ListCredentialsResponse, error)

ListCredentials shows list of awx Credentials.

func (*CredentialService) UpdateCredential added in v0.0.3

func (t *CredentialService) UpdateCredential(id int, data map[string]interface{}, params map[string]string) (*Credential, error)

UpdateCredential update an awx user.

type EventData

type EventData struct {
	PlayPattern  string      `json:"play_pattern"`
	Play         string      `json:"play"`
	EventLoop    interface{} `json:"event_loop"`
	TaskArgs     string      `json:"task_args"`
	RemoteAddr   string      `json:"remote_addr"`
	Res          *EventRes   `json:"res"`
	Pid          int         `json:"pid"`
	PlayUUID     string      `json:"play_uuid"`
	TaskUUID     string      `json:"task_uuid"`
	Task         string      `json:"task"`
	PlaybookUUID string      `json:"playbook_uuid"`
	Playbook     string      `json:"playbook"`
	TaskAction   string      `json:"task_action"`
	Host         string      `json:"host"`
	Role         string      `json:"role"`
	TaskPath     string      `json:"task_path"`
}

EventData represents the awx api event data.

type EventInvocation

type EventInvocation struct {
	ModuleArgs *EventModuleArgs `json:"module_args"`
}

EventInvocation represents the awx api event invocation.

type EventModuleArgs

type EventModuleArgs struct {
	Creates    interface{} `json:"creates"`
	Executable interface{} `json:"executable"`
	UsesShell  bool        `json:"_uses_shell"`
	RawParams  string      `json:"_raw_params"`
	Removes    interface{} `json:"removes"`
	Warn       bool        `json:"warn"`
	Chdir      string      `json:"chdir"`
	Stdin      interface{} `json:"stdin"`
}

EventModuleArgs represents the awx api event module args.

type EventRes

type EventRes struct {
	AnsibleParsed bool             `json:"_ansible_parsed"`
	StderrLines   []string         `json:"stderr_lines"`
	Changed       bool             `json:"changed"`
	End           string           `json:"end"`
	AnsibleNoLog  bool             `json:"_ansible_no_log"`
	Stdout        string           `json:"stdout"`
	Cmd           string           `json:"cmd"`
	Start         string           `json:"start"`
	Delta         string           `json:"delta"`
	Stderr        string           `json:"stderr"`
	Rc            int              `json:"rc"`
	Invocation    *EventInvocation `json:"invocation"`
	StdoutLines   []string         `json:"stdout_lines"`
	Warnings      []string         `json:"warnings"`
}

EventRes represents the awx api event response.

type Group added in v0.0.3

type Group struct {
	ID                       int       `json:"id"`
	Type                     int       `json:"type"`
	URL                      string    `json:"url"`
	Related                  *Related  `json:"related"`
	SummaryFields            *Summary  `json:"summary_fields"`
	Created                  time.Time `json:"created"`
	Modified                 time.Time `json:"modified"`
	Name                     string    `json:"name"`
	Description              string    `json:"description"`
	Inventory                int       `json:"inventory"`
	Variables                string    `json:"variables"`
	HasActiveFailures        bool      `json:"has_active_failures"`
	TotalHosts               int       `json:"total_hosts"`
	HostsWithActiveFailures  int       `json:"hosts_with_active_failures"`
	TotalGroups              int       `json:"total_groups"`
	GroupsWithActiveFailures int       `json:"groups_with_active_failures"`
	HasInventorySources      bool      `json:"has_inventory_sources"`
}

Group represents a group

type GroupService added in v0.0.3

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

GroupService implements awx Groups apis.

func (*GroupService) AddChildGroup added in v0.0.4

func (g *GroupService) AddChildGroup(groupID, childID int) (*Group, error)

func (*GroupService) CreateGroup added in v0.0.3

func (g *GroupService) CreateGroup(data map[string]interface{}, params map[string]string) (*Group, error)

CreateGroup creates an awx Group.

func (*GroupService) DeleteGroup added in v0.0.3

func (g *GroupService) DeleteGroup(id int) (*Group, error)

DeleteGroup delete an awx Group.

func (*GroupService) ListGroups added in v0.0.3

func (g *GroupService) ListGroups(params map[string]string) ([]*Group, *ListGroupsResponse, error)

ListGroups shows list of awx Groups.

func (*GroupService) UpdateGroup added in v0.0.3

func (g *GroupService) UpdateGroup(id int, data map[string]interface{}, params map[string]string) (*Group, error)

UpdateGroup update an awx group

type Groups added in v0.0.3

type Groups struct {
	Count   int      `json:"count"`
	Results []Result `json:"results"`
}

Groups represents the awx api hosts group list

type Host added in v0.0.3

type Host struct {
	ID                   int          `json:"id"`
	Type                 string       `json:"type"`
	URL                  string       `json:"url"`
	Related              *Related     `json:"related"`
	SummaryFields        *Summary     `json:"summary_fields"`
	Created              time.Time    `json:"created"`
	Modified             time.Time    `json:"modified"`
	Name                 string       `json:"name"`
	Description          string       `json:"description"`
	Inventory            int          `json:"inventory"`
	Enabled              bool         `json:"enabled"`
	InstanceID           string       `json:"instance_id"`
	Variables            string       `json:"variables"`
	HasActiveFailures    bool         `json:"has_active_failures"`
	HasInventorySources  bool         `json:"has_inventory_sources"`
	LastJob              *Job         `json:"last_job"`
	LastJobHostSummary   *HostSummary `json:"last_job_host_summary"`
	InsightsSystemID     interface{}  `json:"insights_system_id"`
	AnsibleFactsModified interface{}  `json:"ansible_facts_modified"`
}

Host represents a host

type HostService added in v0.0.3

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

HostService implements awx Hosts apis.

func (*HostService) AssociateGroup added in v0.0.3

func (h *HostService) AssociateGroup(id int, data map[string]interface{}, params map[string]string) (*Host, error)

AssociateGroup update an awx Host

func (*HostService) CreateHost added in v0.0.3

func (h *HostService) CreateHost(data map[string]interface{}, params map[string]string) (*Host, error)

CreateHost creates an awx Host.

func (*HostService) DeleteHost added in v0.0.3

func (h *HostService) DeleteHost(id int) (*Host, error)

DeleteHost delete an awx Host.

func (*HostService) DisAssociateGroup added in v0.0.3

func (h *HostService) DisAssociateGroup(id int, data map[string]interface{}, params map[string]string) (*Host, error)

DisAssociateGroup update an awx Host

func (*HostService) ListHosts added in v0.0.3

func (h *HostService) ListHosts(params map[string]string) ([]*Host, *ListHostsResponse, error)

ListHosts shows list of awx Hosts.

func (*HostService) UpdateHost added in v0.0.3

func (h *HostService) UpdateHost(id int, data map[string]interface{}, params map[string]string) (*Host, error)

UpdateHost update an awx Host

type HostSummariesResponse

type HostSummariesResponse struct {
	Pagination
	Results []HostSummary `json:"results"`
}

HostSummariesResponse represents `JobHostSummaries` endpoint response.

type HostSummary

type HostSummary struct {
	ID            int                `json:"id"`
	Type          string             `json:"type"`
	URL           string             `json:"url"`
	Related       *Related           `json:"related"`
	SummaryFields *HostSummaryFields `json:"summary_fields"`
	Created       time.Time          `json:"created"`
	Modified      time.Time          `json:"modified"`
	Job           int                `json:"job"`
	Host          int                `json:"host"`
	HostName      string             `json:"host_name"`
	Changed       int                `json:"changed"`
	Dark          int                `json:"dark"`
	Failures      int                `json:"failures"`
	Ok            int                `json:"ok"`
	Processed     int                `json:"processed"`
	Skipped       int                `json:"skipped"`
	Failed        bool               `json:"failed"`
}

HostSummary represents the awx api host summary.

type HostSummaryFields

type HostSummaryFields struct {
	Role map[string]string `json:"role"`
	Host *HostSummaryHost  `json:"host"`
	Job  *HostSummaryJob   `json:"job"`
}

HostSummaryFields represents the awx api host summary fields.

type HostSummaryHost

type HostSummaryHost struct {
	ID                  int    `json:"id"`
	Name                string `json:"name"`
	Description         string `json:"description"`
	HasActiveFailures   bool   `json:"has_active_failures"`
	HasInventorySources bool   `json:"has_inventory_sources"`
}

HostSummaryHost represents the awx api host summary host fields.

type HostSummaryJob

type HostSummaryJob struct {
	ID              int     `json:"id"`
	Name            string  `json:"name"`
	Description     string  `json:"description"`
	Status          string  `json:"status"`
	Failed          bool    `json:"failed"`
	Elapsed         float64 `json:"elapsed"`
	JobTemplateID   int     `json:"job_template_id"`
	JobTemplateName string  `json:"job_template_name"`
}

HostSummaryJob represents the awx api host summary job fields.

type Instance

type Instance struct {
	Node      string    `json:"node"`
	Heartbeat time.Time `json:"heartbeat"`
	Version   string    `json:"version"`
	Capacity  int       `json:"capacity"`
}

Instance represents the awx api instance.

type InstanceGroup

type InstanceGroup struct {
	Instances []string `json:"instances"`
	Capacity  int      `json:"capacity"`
	Name      string   `json:"name"`
}

InstanceGroup represents the awx api instance group.

type InstanceGroupSummary

type InstanceGroupSummary struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

InstanceGroupSummary represents the awx api instance group summary fields.

type InventoriesService

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

InventoriesService implements awx inventories apis.

func (*InventoriesService) CreateInventory added in v0.0.2

func (i *InventoriesService) CreateInventory(data map[string]interface{}, params map[string]string) (*Inventory, error)

CreateInventory creates an awx inventory.

func (*InventoriesService) DeleteInventory added in v0.0.3

func (i *InventoriesService) DeleteInventory(id int) (*Inventory, error)

DeleteInventory delete an inventory from AWX

func (*InventoriesService) GetInventory added in v0.0.3

func (i *InventoriesService) GetInventory(id int, params map[string]string) (*Inventory, error)

GetInventory retrives the inventory information from its ID or Name

func (*InventoriesService) ListInventories

func (i *InventoriesService) ListInventories(params map[string]string) ([]*Inventory, *ListInventoriesResponse, error)

ListInventories shows list of awx inventories.

func (*InventoriesService) UpdateInventory added in v0.0.3

func (i *InventoriesService) UpdateInventory(id int, data map[string]interface{}, params map[string]string) (*Inventory, error)

UpdateInventory update an awx inventory

type Inventory

type Inventory struct {
	ID                           int         `json:"id"`
	Type                         string      `json:"type"`
	URL                          string      `json:"url"`
	Related                      *Related    `json:"related"`
	SummaryFields                *Summary    `json:"summary_fields"`
	Created                      time.Time   `json:"created"`
	Modified                     time.Time   `json:"modified"`
	Name                         string      `json:"name"`
	Description                  string      `json:"description"`
	Organization                 int         `json:"organization"`
	OrganizationID               int         `json:"organization_id"`
	Kind                         string      `json:"kind"`
	HostFilter                   interface{} `json:"host_filter"`
	Variables                    string      `json:"variables"`
	HasActiveFailures            bool        `json:"has_active_failures"`
	TotalHosts                   int         `json:"total_hosts"`
	HostsWithActiveFailures      int         `json:"hosts_with_active_failures"`
	TotalGroups                  int         `json:"total_groups"`
	GroupsWithActiveFailures     int         `json:"groups_with_active_failures"`
	HasInventorySources          bool        `json:"has_inventory_sources"`
	TotalInventorySources        int         `json:"total_inventory_sources"`
	InventorySourcesWithFailures int         `json:"inventory_sources_with_failures"`
	InsightsCredential           interface{} `json:"insights_credential"`
	PendingDeletion              bool        `json:"pending_deletion"`
}

Inventory represents the awx api inventory.

type Job

type Job struct {
	ID                      int               `json:"id"`
	Type                    string            `json:"type"`
	URL                     string            `json:"url"`
	Related                 *Related          `json:"related"`
	SummaryFields           *Summary          `json:"summary_fields"`
	Created                 time.Time         `json:"created"`
	Modified                time.Time         `json:"modified"`
	Name                    string            `json:"name"`
	Description             string            `json:"description"`
	JobType                 string            `json:"job_type"`
	Inventory               int               `json:"inventory"`
	Project                 int               `json:"project"`
	Playbook                string            `json:"playbook"`
	Forks                   int               `json:"forks"`
	Limit                   string            `json:"limit"`
	Verbosity               int               `json:"verbosity"`
	ExtraVars               string            `json:"extra_vars"`
	JobTags                 string            `json:"job_tags"`
	ForceHandlers           bool              `json:"force_handlers"`
	SkipTags                string            `json:"skip_tags"`
	StartAtTask             string            `json:"start_at_task"`
	Timeout                 int               `json:"timeout"`
	UseFactCache            bool              `json:"use_fact_cache"`
	UnifiedJobTemplate      int               `json:"unified_job_template"`
	LaunchType              string            `json:"launch_type"`
	Status                  string            `json:"status"`
	Failed                  bool              `json:"failed"`
	Started                 time.Time         `json:"started"`
	Finished                time.Time         `json:"finished"`
	Elapsed                 float64           `json:"elapsed"`
	JobArgs                 string            `json:"job_args"`
	JobCwd                  string            `json:"job_cwd"`
	JobEnv                  map[string]string `json:"job_env"`
	JobExplanation          string            `json:"job_explanation"`
	ExecutionNode           string            `json:"execution_node"`
	ResultTraceback         string            `json:"result_traceback"`
	EventProcessingFinished bool              `json:"event_processing_finished"`
	JobTemplate             int               `json:"job_template"`
	PasswordsNeededToStart  []interface{}     `json:"passwords_needed_to_start"`
	AskDiffModeOnLaunch     bool              `json:"ask_diff_mode_on_launch"`
	AskVariablesOnLaunch    bool              `json:"ask_variables_on_launch"`
	AskLimitOnLaunch        bool              `json:"ask_limit_on_launch"`
	AskTagsOnLaunch         bool              `json:"ask_tags_on_launch"`
	AskSkipTagsOnLaunch     bool              `json:"ask_skip_tags_on_launch"`
	AskJobTypeOnLaunch      bool              `json:"ask_job_type_on_launch"`
	AskVerbosityOnLaunch    bool              `json:"ask_verbosity_on_launch"`
	AskInventoryOnLaunch    bool              `json:"ask_inventory_on_launch"`
	AskCredentialOnLaunch   bool              `json:"ask_credential_on_launch"`
	AllowSimultaneous       bool              `json:"allow_simultaneous"`
	Artifacts               map[string]string `json:"artifacts"`
	ScmRevision             string            `json:"scm_revision"`
	InstanceGroup           int               `json:"instance_group"`
	DiffMode                bool              `json:"diff_mode"`
	Credential              *Credential       `json:"credential"`
	VaultCredential         interface{}       `json:"vault_credential"`
}

Job represents the awx api job.

type JobEvent

type JobEvent struct {
	ID            int                `json:"id"`
	Type          string             `json:"type"`
	URL           string             `json:"url"`
	Related       *Related           `json:"related"`
	SummaryFields *HostSummaryFields `json:"summary_fields"`
	Created       time.Time          `json:"created"`
	Modified      time.Time          `json:"modified"`
	Job           int                `json:"job"`
	Event         string             `json:"event"`
	Counter       int                `json:"counter"`
	EventDisplay  string             `json:"event_display"`
	EventData     *EventData         `json:"event_data"`
	EventLevel    int                `json:"event_level"`
	Failed        bool               `json:"failed"`
	Changed       bool               `json:"changed"`
	UUID          string             `json:"uuid"`
	ParentUUID    string             `json:"parent_uuid"`

	// FIXME: inconsistent value type from tower API, int, null
	Host interface{} `json:"host"`

	HostName  string      `json:"host_name"`
	Parent    interface{} `json:"parent"`
	Playbook  string      `json:"playbook"`
	Play      string      `json:"play"`
	Task      string      `json:"task"`
	Role      string      `json:"role"`
	Stdout    string      `json:"stdout"`
	StartLine int         `json:"start_line"`
	EndLine   int         `json:"end_line"`
	Verbosity int         `json:"verbosity"`
}

JobEvent represents the awx api job event.

type JobEventsResponse

type JobEventsResponse struct {
	Pagination
	Results []JobEvent `json:"results"`
}

JobEventsResponse represents `JobEvents` endpoint response.

type JobLaunch

type JobLaunch struct {
	Job                     int               `json:"job"`
	IgnoredFields           map[string]string `json:"ignored_fields"`
	ID                      int               `json:"id"`
	Type                    string            `json:"type"`
	URL                     string            `json:"url"`
	Related                 *Related          `json:"related"`
	SummaryFields           *Summary          `json:"summary_fields"`
	Created                 time.Time         `json:"created"`
	Modified                time.Time         `json:"modified"`
	Name                    string            `json:"name"`
	Description             string            `json:"description"`
	JobType                 string            `json:"job_type"`
	Inventory               int               `json:"inventory"`
	Project                 int               `json:"project"`
	Playbook                string            `json:"playbook"`
	Forks                   int               `json:"forks"`
	Limit                   string            `json:"limit"`
	Verbosity               int               `json:"verbosity"`
	ExtraVars               string            `json:"extra_vars"`
	JobTags                 string            `json:"job_tags"`
	ForceHandlers           bool              `json:"force_handlers"`
	SkipTags                string            `json:"skip_tags"`
	StartAtTask             string            `json:"start_at_task"`
	Timeout                 int               `json:"timeout"`
	UseFactCache            bool              `json:"use_fact_cache"`
	UnifiedJobTemplate      int               `json:"unified_job_template"`
	LaunchType              string            `json:"launch_type"`
	Status                  string            `json:"status"`
	Failed                  bool              `json:"failed"`
	Started                 interface{}       `json:"started"`
	Finished                interface{}       `json:"finished"`
	Elapsed                 int               `json:"elapsed"`
	JobArgs                 string            `json:"job_args"`
	JobCwd                  string            `json:"job_cwd"`
	JobEnv                  map[string]string `json:"job_env"`
	JobExplanation          string            `json:"job_explanation"`
	ExecutionNode           string            `json:"execution_node"`
	ResultTraceback         string            `json:"result_traceback"`
	EventProcessingFinished bool              `json:"event_processing_finished"`
	JobTemplate             int               `json:"job_template"`
	PasswordsNeededToStart  []interface{}     `json:"passwords_needed_to_start"`
	AskDiffModeOnLaunch     bool              `json:"ask_diff_mode_on_launch"`
	AskVariablesOnLaunch    bool              `json:"ask_variables_on_launch"`
	AskLimitOnLaunch        bool              `json:"ask_limit_on_launch"`
	AskTagsOnLaunch         bool              `json:"ask_tags_on_launch"`
	AskSkipTagsOnLaunch     bool              `json:"ask_skip_tags_on_launch"`
	AskJobTypeOnLaunch      bool              `json:"ask_job_type_on_launch"`
	AskVerbosityOnLaunch    bool              `json:"ask_verbosity_on_launch"`
	AskInventoryOnLaunch    bool              `json:"ask_inventory_on_launch"`
	AskCredentialOnLaunch   bool              `json:"ask_credential_on_launch"`
	AllowSimultaneous       bool              `json:"allow_simultaneous"`
	Artifacts               map[string]string `json:"artifacts"`
	ScmRevision             string            `json:"scm_revision"`
	InstanceGroup           interface{}       `json:"instance_group"`
	DiffMode                bool              `json:"diff_mode"`
	Credential              int               `json:"credential"`
	VaultCredential         interface{}       `json:"vault_credential"`
}

JobLaunch represents the awx api job launch.

type JobLaunchOpts added in v0.1.1

type JobLaunchOpts struct {
	ExtraVars           map[string]interface{} `json:"extra_vars,omitempty"`
	Inventory           int                    `json:"inventory,omitempty"`
	Limit               string                 `json:"limit,omitempty"`
	JobTags             string                 `json:"job_tags,omitempty"`
	SkipTags            string                 `json:"skip_tags,omitempty"`
	JobType             string                 `json:"job_type,omitempty"`
	Verbosity           int                    `json:"verbosity,omitempty"`
	DiffMode            interface{}            `json:"diff_mode,omitempty"`
	Credentials         []int                  `json:"credentials,omitempty"`
	CredentialPasswords []string               `json:"credential_passwords,omitempty"`
}

type JobService

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

JobService implements awx job apis.

func (*JobService) CancelJob

func (j *JobService) CancelJob(id int, data map[string]interface{}, params map[string]string) (*CancelJobResponse, error)

CancelJob cancels a job.

func (*JobService) GetHostSummaries

func (j *JobService) GetHostSummaries(id int, params map[string]string) ([]HostSummary, *HostSummariesResponse, error)

GetHostSummaries get a job hosts summaries.

func (*JobService) GetJob

func (j *JobService) GetJob(id int, params map[string]string) (*Job, error)

GetJob shows the details of a job.

func (*JobService) GetJobEvents

func (j *JobService) GetJobEvents(id int, params map[string]string) ([]JobEvent, *JobEventsResponse, error)

GetJobEvents get a list of job events.

func (*JobService) GetJobStdOut added in v0.0.6

func (j *JobService) GetJobStdOut(id int) (*JobStdoutResponse, error)

func (*JobService) RelaunchJob

func (j *JobService) RelaunchJob(id int, data map[string]interface{}, params map[string]string) (*JobLaunch, error)

RelaunchJob relaunch a job.

type JobStdoutResponse added in v0.0.6

type JobStdoutResponse struct {
	Range struct {
		Start       int `json:"start"`
		End         int `json:"end"`
		AbsoluteEnd int `json:"absolute_end"`
	} `json:"range"`
	Content string `json:"content"`
}

type JobTemplate

type JobTemplate struct {
	ID                    int         `json:"id"`
	Type                  string      `json:"type"`
	URL                   string      `json:"url"`
	Related               *Related    `json:"related"`
	SummaryFields         *Summary    `json:"summary_fields"`
	Created               time.Time   `json:"created"`
	Modified              time.Time   `json:"modified"`
	Name                  string      `json:"name"`
	Description           string      `json:"description"`
	JobType               string      `json:"job_type"`
	Inventory             int         `json:"inventory"`
	Project               int         `json:"project"`
	Playbook              string      `json:"playbook"`
	ScmBranch             string      `json:"scm_branch"`
	Forks                 int         `json:"forks"`
	Limit                 string      `json:"limit"`
	Verbosity             int         `json:"verbosity"`
	ExtraVars             string      `json:"extra_vars"`
	JobTags               string      `json:"job_tags"`
	ForceHandlers         bool        `json:"force_handlers"`
	SkipTags              string      `json:"skip_tags"`
	StartAtTask           string      `json:"start_at_task"`
	Timeout               int         `json:"timeout"`
	UseFactCache          bool        `json:"use_fact_cache"`
	LastJobRun            interface{} `json:"last_job_run"`
	LastJobFailed         bool        `json:"last_job_failed"`
	NextJobRun            interface{} `json:"next_job_run"`
	Status                string      `json:"status"`
	HostConfigKey         string      `json:"host_config_key"`
	AskScmBranchOnLaunch  bool        `json:"ask_scm_branch_on_launch"`
	AskDiffModeOnLaunch   bool        `json:"ask_diff_mode_on_launch"`
	AskVariablesOnLaunch  bool        `json:"ask_variables_on_launch"`
	AskLimitOnLaunch      bool        `json:"ask_limit_on_launch"`
	AskTagsOnLaunch       bool        `json:"ask_tags_on_launch"`
	AskSkipTagsOnLaunch   bool        `json:"ask_skip_tags_on_launch"`
	AskJobTypeOnLaunch    bool        `json:"ask_job_type_on_launch"`
	AskVerbosityOnLaunch  bool        `json:"ask_verbosity_on_launch"`
	AskInventoryOnLaunch  bool        `json:"ask_inventory_on_launch"`
	AskCredentialOnLaunch bool        `json:"ask_credential_on_launch"`
	SurveyEnabled         bool        `json:"survey_enabled"`
	BecomeEnabled         bool        `json:"become_enabled"`
	DiffMode              bool        `json:"diff_mode"`
	AllowSimultaneous     bool        `json:"allow_simultaneous"`
	CustomVirtualenv      interface{} `json:"custom_virtualenv"`
	JobSliceCount         int         `json:"job_slice_count"`
	WebhookService        string      `json:"webhook_service"`
	WebhookCredential     string      `json:"webhook_credential"`

	// Not found in browsable API (OPTIONS on https://<awx-server>/api/v2/job_templates/)
	Credential      int         `json:"credential"`
	VaultCredential interface{} `json:"vault_credential"`
	AllowCallbacks  bool        `json:"allow_callbacks"`
}

JobTemplate represents the awx api job template.

type JobTemplateService

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

JobTemplateService implements awx job template apis.

func (*JobTemplateService) AddJobTemplateCredential added in v0.0.6

func (jt *JobTemplateService) AddJobTemplateCredential(jobTemplateID int, credID int) (*JobTemplate, error)

func (*JobTemplateService) CreateJobTemplate added in v0.0.3

func (jt *JobTemplateService) CreateJobTemplate(data map[string]interface{}, params map[string]string) (*JobTemplate, error)

CreateJobTemplate creates a job template

func (*JobTemplateService) CreateJobTemplateCallBack added in v0.2.1

func (jt *JobTemplateService) CreateJobTemplateCallBack(template *JobTemplate) (*JobTemplate, error)

CreateJobTemplateCallBack executes a PATCH HTTP Request to create the callback url and the generated host_config_key

func (*JobTemplateService) DeleteJobTemplate added in v0.0.3

func (jt *JobTemplateService) DeleteJobTemplate(id int) (*JobTemplate, error)

DeleteJobTemplate deletes a job template

func (*JobTemplateService) GetJobTemplate added in v0.0.8

func (jt *JobTemplateService) GetJobTemplate(id int) (*JobTemplate, error)

GetJobTemplate gets a job template

func (*JobTemplateService) GetSurveySpec added in v0.2.1

func (jt *JobTemplateService) GetSurveySpec(jobTemplate *JobTemplate) ([]byte, error)

func (*JobTemplateService) Launch

func (jt *JobTemplateService) Launch(id int, data *JobLaunchOpts, params map[string]string) (*JobLaunch, error)

Launch launches a job with the job template.

func (*JobTemplateService) ListJobTemplates

func (jt *JobTemplateService) ListJobTemplates(params map[string]string) ([]*JobTemplate, *ListJobTemplatesResponse, error)

ListJobTemplates shows a list of job templates.

func (*JobTemplateService) UpdateJobTemplate added in v0.0.3

func (jt *JobTemplateService) UpdateJobTemplate(id int, data map[string]interface{}, params map[string]string) (*JobTemplate, error)

UpdateJobTemplate updates a job template

type JobTemplateSummary

type JobTemplateSummary struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

JobTemplateSummary represents the awx api job template summary fields.

type Labels

type Labels struct {
	Count   int           `json:"count"`
	Results []interface{} `json:"results"`
}

Labels represents the awx api labels.

type ListCredentialsResponse added in v0.0.3

type ListCredentialsResponse struct {
	Pagination
	Results []*Credential `json:"results"`
}

ListCredentialsResponse represents `ListCredentials` endpoint response.

type ListGroupsResponse added in v0.0.3

type ListGroupsResponse struct {
	Pagination
	Results []*Group `json:"results"`
}

ListGroupsResponse represents `ListGroups` endpoint response.

type ListHostsResponse added in v0.0.3

type ListHostsResponse struct {
	Pagination
	Results []*Host `json:"results"`
}

ListHostsResponse represents `ListHosts` endpoint response.

type ListInventoriesResponse

type ListInventoriesResponse struct {
	Pagination
	Results []*Inventory `json:"results"`
}

ListInventoriesResponse represents `ListInventories` endpoint response.

type ListJobTemplatesResponse

type ListJobTemplatesResponse struct {
	Pagination
	Results []*JobTemplate `json:"results"`
}

ListJobTemplatesResponse represents `ListJobTemplates` endpoint response.

type ListOrganizationsResponse added in v0.0.3

type ListOrganizationsResponse struct {
	Pagination
	Results []*Organization `json:"results"`
}

ListOrganizationsResponse represents `ListOrganizations` endpoint response.

type ListProjectsResponse added in v0.0.3

type ListProjectsResponse struct {
	Pagination
	Results []*Project `json:"results"`
}

ListProjectsResponse represents `ListProjects` endpoint response.

type ListTeamsResponse added in v0.0.3

type ListTeamsResponse struct {
	Pagination
	Results []*Team `json:"results"`
}

ListTeamsResponse represents `ListTeams` endpoint response.

type ListUsersResponse added in v0.0.3

type ListUsersResponse struct {
	Pagination
	Results []*User `json:"results"`
}

ListUsersResponse represents `ListUsers` endpoint response.

type ObjectRole added in v0.2.1

type ObjectRole struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type ObjectRoles

type ObjectRoles struct {
	UseRole               *ObjectRole `json:"use_role"`
	AdminRole             *ObjectRole `json:"admin_role"`
	AdhocRole             *ObjectRole `json:"adhoc_role"`
	UpdateRole            *ObjectRole `json:"update_role"`
	ReadRole              *ObjectRole `json:"read_role"`
	ExecuteRole           *ObjectRole `json:"execute_role"`
	MemberRole            *ObjectRole `json:"member_role"`
	NotificationAdminRole *ObjectRole `json:"notification_admin_role"`
	WorkflowAdminRole     *ObjectRole `json:"workflow_admin_role"`
	CredentialAdminRole   *ObjectRole `json:"credential_admin_role"`
	JobTemplateAdminRole  *ObjectRole `json:"job_template_admin_role"`
	ProjectAdminRole      *ObjectRole `json:"project_admin_role"`
	AuditorRole           *ObjectRole `json:"auditor_role"`
	InventoryAdminRole    *ObjectRole `json:"inventory_admin_role"`
}

ObjectRoles represents the awx api object roles.

type Organization added in v0.0.3

type Organization struct {
	ID               int           `json:"id"`
	Type             string        `json:"type"`
	URL              string        `json:"url"`
	Related          Related       `json:"related"`
	SummaryFields    SummaryFields `json:"summary_fields"`
	Created          time.Time     `json:"created"`
	Modified         time.Time     `json:"modified"`
	Name             string        `json:"name"`
	Description      string        `json:"description"`
	CustomVirtualEnv interface{}   `json:"custom_virtualenv"`
}

type OrganizationService added in v0.0.3

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

OrganizationService implements awx Organizations apis.

func (*OrganizationService) CreateOrganization added in v0.0.3

func (t *OrganizationService) CreateOrganization(data map[string]interface{}, params map[string]string) (*Organization, error)

CreateOrganization creates an awx Organization.

func (*OrganizationService) DeleteOrganization added in v0.0.3

func (t *OrganizationService) DeleteOrganization(id int) (*Organization, error)

DeleteOrganization delete an awx Organization.

func (*OrganizationService) ListOrganizations added in v0.0.3

func (t *OrganizationService) ListOrganizations(params map[string]string) ([]*Organization, *ListOrganizationsResponse, error)

ListOrganizations shows list of awx Organizations.

func (*OrganizationService) UpdateOrganization added in v0.0.3

func (t *OrganizationService) UpdateOrganization(id int, data map[string]interface{}, params map[string]string) (*Organization, error)

UpdateOrganization update an awx user.

type OrganizationSummary added in v0.2.1

type OrganizationSummary struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

OrganizationSummary represents the awx api organization summary fields.

type Pagination

type Pagination struct {
	Count    int         `json:"count"`
	Next     interface{} `json:"next"`
	Previous interface{} `json:"previous"`
}

Pagination represents the awx api pagination params.

type Ping

type Ping struct {
	Instances      []Instance      `json:"instances"`
	InstanceGroups []InstanceGroup `json:"instance_groups"`
	Ha             bool            `json:"ha"`
	Version        string          `json:"version"`
	ActiveNode     string          `json:"active_node"`
}

Ping represents the awx api ping.

type PingService

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

PingService implements awx ping apis.

func (*PingService) Ping

func (p *PingService) Ping() (*Ping, error)

Ping do ping with awx servers.

type Project

type Project struct {
	ID                    int       `json:"id"`
	Type                  string    `json:"type"`
	URL                   string    `json:"url"`
	Related               *Related  `json:"related"`
	SummaryFields         *Summary  `json:"summary_fields"`
	Created               time.Time `json:"created"`
	Modified              time.Time `json:"modified"`
	Name                  string    `json:"name"`
	Description           string    `json:"description"`
	LocalPath             string    `json:"local_path"`
	ScmType               string    `json:"scm_type"`
	ScmURL                string    `json:"scm_url"`
	ScmBranch             string    `json:"scm_branch"`
	ScmRefSpec            string    `json:"scm_refspec"`
	ScmClean              bool      `json:"scm_clean"`
	ScmDeleteOnUpdate     bool      `json:"scm_delete_on_update"`
	Credential            string    `json:"credential"`
	Timeout               int       `json:"timeout"`
	ScmRevision           string    `json:"scm_revision"`
	LastJobRun            time.Time `json:"last_job_run"`
	LastJobFailed         bool      `json:"last_job_failed"`
	NextJobRun            time.Time `json:"next_job_run"`
	Status                string    `json:"status"`
	Organization          int       `json:"organization"`
	ScmUpdateOnLaunch     bool      `json:"scm_update_on_launch"`
	ScmUpdateCacheTimeout int       `json:"scm_update_cache_timeout"`
	AllowOverride         bool      `json:"allow_override"`
	CustomVirtualenv      string    `json:"custom_virtualenv"`
	LastUpdateFailed      bool      `json:"last_update_failed"`
	LastUpdated           time.Time `json:"last_updated"`
}

Project represents the awx api project.

type ProjectService added in v0.0.3

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

ProjectService implements awx projects apis.

func (*ProjectService) CreateProject added in v0.0.3

func (p *ProjectService) CreateProject(data map[string]interface{}, params map[string]string) (*Project, error)

CreateProject creates an awx project.

func (*ProjectService) DeleteProject added in v0.0.3

func (p *ProjectService) DeleteProject(id int) (*Project, error)

DeleteProject delete an awx Project.

func (*ProjectService) ListProjects added in v0.0.3

func (p *ProjectService) ListProjects(params map[string]string) ([]*Project, *ListProjectsResponse, error)

ListProjects shows list of awx projects.

func (*ProjectService) UpdateProject added in v0.0.3

func (p *ProjectService) UpdateProject(id int, data map[string]interface{}, params map[string]string) (*Project, error)

UpdateProject update an awx Project.

type ProjectUpdate

type ProjectUpdate struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Status      string `json:"status"`
	Failed      bool   `json:"failed"`
}

ProjectUpdate represents the awx api project update.

type ProjectUpdateCancel added in v0.0.3

type ProjectUpdateCancel struct {
	CanCancel bool `json:"can_cancel"`
}

ProjectUpdateCancel represents the awx project update cancel api response.

type ProjectUpdatesService added in v0.0.3

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

ProjectUpdatesService implements awx projects apis.

func (*ProjectUpdatesService) ProjectUpdateCancel added in v0.0.3

func (p *ProjectUpdatesService) ProjectUpdateCancel(id int) (*ProjectUpdateCancel, error)

ProjectUpdateCancel cancel of awx projects update.

func (*ProjectUpdatesService) ProjectUpdateGet added in v0.0.3

func (p *ProjectUpdatesService) ProjectUpdateGet(id int) (*Job, error)

ProjectUpdateGet get of awx projects update.

type Related struct {
	NamedURL                     string `json:"named_url"`
	CreatedBy                    string `json:"created_by"`
	ModifiedBy                   string `json:"modified_by"`
	JobTemplates                 string `json:"job_templates"`
	VariableData                 string `json:"variable_data"`
	RootGroups                   string `json:"root_groups"`
	ObjectRoles                  string `json:"object_roles"`
	AdHocCommands                string `json:"ad_hoc_commands"`
	Script                       string `json:"script"`
	Tree                         string `json:"tree"`
	AccessList                   string `json:"access_list"`
	ActivityStream               string `json:"activity_stream"`
	InstanceGroups               string `json:"instance_groups"`
	Hosts                        string `json:"hosts"`
	Job                          string `json:"job"`
	Host                         string `json:"host"`
	Groups                       string `json:"groups"`
	Copy                         string `json:"copy"`
	UpdateInventorySources       string `json:"update_inventory_sources"`
	InventorySources             string `json:"inventory_sources"`
	FactVersions                 string `json:"fact_versions"`
	SmartInventories             string `json:"smart_inventories"`
	Insights                     string `json:"insights"`
	Organization                 string `json:"organization"`
	Labels                       string `json:"labels"`
	Inventory                    string `json:"inventory"`
	Project                      string `json:"project"`
	Credential                   string `json:"credential"`
	ExtraCredentials             string `json:"extra_credentials"`
	Credentials                  string `json:"credentials"`
	NotificationTemplatesError   string `json:"notification_templates_error"`
	NotificationTemplatesSuccess string `json:"notification_templates_success"`
	Jobs                         string `json:"jobs"`
	NotificationTemplatesAny     string `json:"notification_templates_any"`
	Launch                       string `json:"launch"`
	Schedules                    string `json:"schedules"`
	SurveySpec                   string `json:"survey_spec"`
	UnifiedJobTemplate           string `json:"unified_job_template"`
	Stdout                       string `json:"stdout"`
	Notifications                string `json:"notifications"`
	JobHostSummaries             string `json:"job_host_summaries"`
	JobEvents                    string `json:"job_events"`
	JobTemplate                  string `json:"job_template"`
	Cancel                       string `json:"cancel"`
	ProjectUpdate                string `json:"project_update"`
	CreateSchedule               string `json:"create_schedule"`
	Relaunch                     string `json:"relaunch"`
	AdminOfOrganizations         string `json:"admin_of_organizations"`
	Organizations                string `json:"organizations"`
	Roles                        string `json:"roles"`
	Teams                        string `json:"teams"`
	Projects                     string `json:"projects"`
	PotentialChildren            string `json:"potential_children"`
	AllHosts                     string `json:"all_hosts"`
	AllGroups                    string `json:"all_groups"`
	AdHocCommandEvents           string `json:"ad_hoc_command_events"`
	Children                     string `json:"children"`
	AnsibleFacts                 string `json:"ansible_facts"`
	Callback                     string `json:"callback"`
}

Related represents the awx api related field.

type RelatedFieldCounts added in v0.0.3

type RelatedFieldCounts struct {
	JobTemplates int `json:"job_templates"`
	Users        int `json:"users"`
	Teams        int `json:"teams"`
	Admins       int `json:"admins"`
	Inventories  int `json:"inventories"`
	Projects     int `json:"projects"`
}

type Requester

type Requester struct {
	Base      string
	BasicAuth *BasicAuth
	Client    *http.Client
}

Requester implemented a base http client. It supports do POST/GET via an human-readable way, in other word, all data is in `application/json` format. It also originally supports basic auth. For production usage, It would be better to wrapper an another rest client on this requester.

func (*Requester) Delete added in v0.0.3

func (r *Requester) Delete(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

Delete performs http Delete request.

func (*Requester) Do

func (r *Requester) Do(ar *APIRequest, responseStruct interface{}, options ...interface{}) (*http.Response, error)

Do do the actual http request.

func (*Requester) Get

func (r *Requester) Get(endpoint string, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

Get performs http get request.

func (*Requester) GetJSON

func (r *Requester) GetJSON(endpoint string, responseStruct interface{}, query map[string]string) (*http.Response, error)

GetJSON performs http get request with json response.

func (*Requester) PatchJSON added in v0.0.3

func (r *Requester) PatchJSON(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

PatchJSON perform http patch request with json response

func (*Requester) Post

func (r *Requester) Post(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

Post performs http post request.

func (*Requester) PostJSON

func (r *Requester) PostJSON(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

PostJSON performs http post request with json response.

func (*Requester) PutJSON added in v0.0.3

func (r *Requester) PutJSON(endpoint string, payload io.Reader, responseStruct interface{}, querystring map[string]string) (*http.Response, error)

PutJSON perform http PUT request with json response

func (*Requester) ReadJSONResponse

func (r *Requester) ReadJSONResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)

ReadJSONResponse reads the http raw response and decodes into json.

func (*Requester) ReadRawResponse

func (r *Requester) ReadRawResponse(response *http.Response, responseStruct interface{}) (*http.Response, error)

ReadRawResponse reads the http raw response and store it into `responseStruct`.

type Result added in v0.0.3

type Result struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

Result data type

type Spec added in v0.2.1

type Spec struct {
	QuestionName        string `json:"question_name"`
	QuestionDescription string `json:"question_description"`
	Required            bool   `json:"required"`
	Type                string `json:"type"`
	Variable            string `json:"variable"`
	Min                 int    `json:"min"`
	Max                 int    `json:"max"`
	Default             string `json:"default"`
	Choices             string `json:"choices"`
	NewQuestion         bool   `json:"new_question"`
}

type Summary

type Summary struct {
	InstanceGroup      *InstanceGroupSummary  `json:"instance_group"`
	Organization       *OrganizationSummary   `json:"organization"`
	CreatedBy          *ByUserSummary         `json:"created_by"`
	ModifiedBy         *ByUserSummary         `json:"modified_by"`
	ObjectRoles        *ObjectRoles           `json:"object_roles"`
	UserCapabilities   *UserCapabilities      `json:"user_capabilities"`
	Project            *Project               `json:"project"`
	LastJob            map[string]interface{} `json:"last_job"`
	CurrentJob         map[string]interface{} `json:"current_job"`
	LastUpdate         map[string]interface{} `json:"last_update"`
	Inventory          *Inventory             `json:"inventory"`
	RecentJobs         []interface{}          `json:"recent_jobs"`
	Groups             *Groups                `json:"groups"`
	Credentials        []Credential           `json:"credentials"`
	Credential         *Credential            `json:"credential"`
	Labels             *Labels                `json:"labels"`
	JobTemplate        *JobTemplateSummary    `json:"job_template"`
	UnifiedJobTemplate *UnifiedJobTemplate    `json:"unified_job_template"`
	ExtraCredentials   []interface{}          `json:"extra_credentials"`
	ProjectUpdate      *ProjectUpdate         `json:"project_update"`
}

Summary represents the awx api summary fields.

type SummaryFields added in v0.0.3

type SummaryFields struct {
	CreatedBy          ByUserSummary      `json:"created_by"`
	ModifiedBy         ByUserSummary      `json:"modified_by"`
	ObjectRoles        ObjectRoles        `json:"object_roles"`
	UserCapabilities   UserCapabilities   `json:"user_capabilities"`
	RelatedFieldCounts RelatedFieldCounts `json:"related_field_counts"`
}

type SurveySpec added in v0.2.1

type SurveySpec struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Spec        []Spec `json:"spec"`
}

type Team added in v0.0.3

type Team struct {
	ID            int           `json:"id"`
	Type          string        `json:"type"`
	URL           string        `json:"url"`
	Related       Related       `json:"related"`
	SummaryFields SummaryFields `json:"summary_fields"`
	Created       time.Time     `json:"created"`
	Modified      time.Time     `json:"modified"`
	Name          string        `json:"name"`
	Description   string        `json:"description"`
	Organization  int           `json:"organization"`
}

type TeamService added in v0.0.3

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

TeamService implements awx Teams apis.

func (*TeamService) CreateTeam added in v0.0.3

func (t *TeamService) CreateTeam(data map[string]interface{}, params map[string]string) (*Team, error)

CreateTeam creates an awx Team.

func (*TeamService) DeleteTeam added in v0.0.3

func (t *TeamService) DeleteTeam(id int) (*Team, error)

DeleteTeam delete an awx Team.

func (*TeamService) GrantRole added in v0.0.3

func (t *TeamService) GrantRole(id int, roleID int) error

GrantRole grant the provided role to the AWX Team

func (*TeamService) ListTeams added in v0.0.3

func (t *TeamService) ListTeams(params map[string]string) ([]*Team, *ListTeamsResponse, error)

ListTeams shows list of awx Teams.

func (*TeamService) RevokeRole added in v0.0.3

func (t *TeamService) RevokeRole(id int, roleID int) error

RevokeRole revoke the provided role to the AWX Team

func (*TeamService) UpdateTeam added in v0.0.3

func (t *TeamService) UpdateTeam(id int, data map[string]interface{}, params map[string]string) (*Team, error)

UpdateTeam update an awx user.

type UnifiedJobTemplate

type UnifiedJobTemplate struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	UnifiedJobType string `json:"unified_job_type"`
}

UnifiedJobTemplate represents the awx api unified job template.

type User added in v0.0.3

type User struct {
	ID              int         `json:"id"`
	Type            int         `json:"type"`
	URL             string      `json:"url"`
	Related         *Related    `json:"related"`
	SummaryFields   *Summary    `json:"summary_fields"`
	Created         time.Time   `json:"created"`
	Username        string      `json:"username"`
	FirstName       string      `json:"first_name"`
	LastName        string      `json:"last_name"`
	Email           string      `json:"email"`
	IsSuperUser     bool        `json:"is_superuser"`
	IsSystemAuditor bool        `json:"is_system_auditor"`
	Password        string      `json:"password"`
	LdapDn          string      `json:"ldap_dn"`
	ExternalAccount interface{} `json:"external_account"`
}

User represents an user

type UserCapabilities

type UserCapabilities struct {
	Edit     bool `json:"edit"`
	Start    bool `json:"start"`
	Schedule bool `json:"schedule"`
	Copy     bool `json:"copy"`
	Adhoc    bool `json:"adhoc"`
	Delete   bool `json:"delete"`
}

UserCapabilities represents the awx api user capabilities.

type UserService added in v0.0.3

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

UserService implements awx Users apis.

func (*UserService) CreateUser added in v0.0.3

func (u *UserService) CreateUser(data map[string]interface{}, params map[string]string) (*User, error)

CreateUser creates an awx User.

func (*UserService) DeleteUser added in v0.0.3

func (u *UserService) DeleteUser(id int) (*User, error)

DeleteUser delete an awx User.

func (*UserService) GrantRole added in v0.0.3

func (u *UserService) GrantRole(id, roleID string) error

func (*UserService) ListUsers added in v0.0.3

func (u *UserService) ListUsers(params map[string]string) ([]*User, *ListUsersResponse, error)

ListUsers shows list of awx Users.

func (*UserService) RevokeRole added in v0.0.3

func (u *UserService) RevokeRole(id, roleID string) error

func (*UserService) UpdateUser added in v0.0.3

func (u *UserService) UpdateUser(id int, data map[string]interface{}, params map[string]string) (*User, error)

UpdateUser update an awx user.

Directories

Path Synopsis
awxtesting

Jump to

Keyboard shortcuts

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