CoreService

<back to all web services

CreateActionAssignment

Action - CRUD

Adds an action to a config item

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
POST/api/action-assignmentsAssigns an action to a config item
POST/action-assignmentsAssigns an action to a config item
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


enum ObjectTypes : string
{
    case None = 'None';
    case ConfigItem = 'ConfigItem';
    case Tenant = 'Tenant';
    case Collection = 'Collection';
    case Resource = 'Resource';
    case ComputeNode = 'ComputeNode';
    case VirtualMachine = 'VirtualMachine';
    case PhysicalMachine = 'PhysicalMachine';
    case Disk = 'Disk';
    case Subnet = 'Subnet';
    case IPAddress = 'IPAddress';
    case Job = 'Job';
    case JobEvent = 'JobEvent';
    case FreezePeriod = 'FreezePeriod';
    case ResourceGroup = 'ResourceGroup';
    case Deployment = 'Deployment';
    case ResourceGroupTemplate = 'ResourceGroupTemplate';
    case DeploymentTemplate = 'DeploymentTemplate';
    case ResourceProvider = 'ResourceProvider';
    case GenericResource = 'GenericResource';
    case Role = 'Role';
    case Permission = 'Permission';
    case User = 'User';
    case PatchingWindow = 'PatchingWindow';
    case Update = 'Update';
    case ReportDefinition = 'ReportDefinition';
    case TimeSeries = 'TimeSeries';
    case DataPoint = 'DataPoint';
    case Action = 'Action';
    case ActionAssignment = 'ActionAssignment';
    case UserNote = 'UserNote';
}

enum ParameterValueType : string
{
    case String = 'String';
    case Number = 'Number';
    case Boolean = 'Boolean';
    case SecureString = 'SecureString';
}

class ParameterDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $name='',
        /** @var string|null */
        public ?string $description=null,
        /** @description Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes */
        /** @var string|null */
        public ?string $value=null,
        /** @description Optional default value for the frontend. Needs to be in the same format as the value */
        /** @var string|null */
        public ?string $default=null,
        /** @description Optional parameters do not need to have a value. Default -> Optional=false */
        /** @var bool|null */
        public ?bool $optional=null,
        /** @description The data type of the value and default property */
        /** @var ParameterValueType|null */
        public ?ParameterValueType $type=null,
        /** @var string|null */
        public ?string $validation=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['value'])) $this->value = $o['value'];
        if (isset($o['default'])) $this->default = $o['default'];
        if (isset($o['optional'])) $this->optional = $o['optional'];
        if (isset($o['type'])) $this->type = JsonConverters::from('ParameterValueType', $o['type']);
        if (isset($o['validation'])) $this->validation = $o['validation'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->value)) $o['value'] = $this->value;
        if (isset($this->default)) $o['default'] = $this->default;
        if (isset($this->optional)) $o['optional'] = $this->optional;
        if (isset($this->type)) $o['type'] = JsonConverters::to('ParameterValueType', $this->type);
        if (isset($this->validation)) $o['validation'] = $this->validation;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Adds an action to a config item */
// @Api(Description="Adds an action to a config item")
// @ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType="typeof(CoreService.ServiceModel.Dtos.ActionAssignments.Responses.ActionAssignmentDto)", StatusCode=201)
class CreateActionAssignment implements IPost, ISchedulableRequest, JsonSerializable
{
    public function __construct(
        // @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $tenantName='',

        /** @description The unique id of the config item */
        // @ApiMember(DataType="string", Description="The unique id of the config item", Format="guid", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $configItemId='',

        /** @description The type of the config item (either Deployment, ResourceGroup or Resource) */
        // @ApiMember(Description="The type of the config item (either Deployment, ResourceGroup or Resource)", IsRequired=true, ParameterType="body")
        // @Validate(Validator="NotNull")
        /** @var ObjectTypes|null */
        public ?ObjectTypes $configItemType=null,

        // @ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")
        /** @var string */
        public string $actionId='',

        /** @description A unique name for the action */
        // @ApiMember(DataType="string", Description="A unique name for the action", IsRequired=true, ParameterType="body")
        // @Validate(Validator="NotEmpty")
        /** @var string */
        public string $name='',

        // @ApiMember(DataType="array", ParameterType="body")
        /** @var array<ParameterDto>|null */
        public ?array $parameters=null,

        /** @description The cron expression for scheduling the operation */
        // @ApiMember(DataType="string", Description="The cron expression for scheduling the operation", Format="Cron", ParameterType="body")
        /** @var string|null */
        public ?string $cronExpression=null,

        /** @description Inform users when the job has finished */
        // @ApiMember(DataType="bool", Description="Inform users when the job has finished", ParameterType="body")
        /** @var bool|null */
        public ?bool $sendNotifications=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['tenantName'])) $this->tenantName = $o['tenantName'];
        if (isset($o['configItemId'])) $this->configItemId = $o['configItemId'];
        if (isset($o['configItemType'])) $this->configItemType = JsonConverters::from('ObjectTypes', $o['configItemType']);
        if (isset($o['actionId'])) $this->actionId = $o['actionId'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['parameters'])) $this->parameters = JsonConverters::fromArray('ParameterDto', $o['parameters']);
        if (isset($o['cronExpression'])) $this->cronExpression = $o['cronExpression'];
        if (isset($o['sendNotifications'])) $this->sendNotifications = $o['sendNotifications'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->tenantName)) $o['tenantName'] = $this->tenantName;
        if (isset($this->configItemId)) $o['configItemId'] = $this->configItemId;
        if (isset($this->configItemType)) $o['configItemType'] = JsonConverters::to('ObjectTypes', $this->configItemType);
        if (isset($this->actionId)) $o['actionId'] = $this->actionId;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->parameters)) $o['parameters'] = JsonConverters::toArray('ParameterDto', $this->parameters);
        if (isset($this->cronExpression)) $o['cronExpression'] = $this->cronExpression;
        if (isset($this->sendNotifications)) $o['sendNotifications'] = $this->sendNotifications;
        return empty($o) ? new class(){} : $o;
    }
}

class TagDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $name='',
        /** @var string|null */
        public ?string $value=null,
        /** @var bool|null */
        public ?bool $isProtected=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['value'])) $this->value = $o['value'];
        if (isset($o['isProtected'])) $this->isProtected = $o['isProtected'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->value)) $o['value'] = $this->value;
        if (isset($this->isProtected)) $o['isProtected'] = $this->isProtected;
        return empty($o) ? new class(){} : $o;
    }
}

class PathItemDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $label='',
        /** @var string */
        public string $link='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null,
        /** @var string */
        public string $objectId=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['label'])) $this->label = $o['label'];
        if (isset($o['link'])) $this->link = $o['link'];
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
        if (isset($o['objectId'])) $this->objectId = $o['objectId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->label)) $o['label'] = $this->label;
        if (isset($this->link)) $o['link'] = $this->link;
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        if (isset($this->objectId)) $o['objectId'] = $this->objectId;
        return empty($o) ? new class(){} : $o;
    }
}

class LinkDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $caption='',
        /** @var string */
        public string $rel='',
        /** @var string */
        public string $hRef='',
        /** @var string */
        public string $method=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['caption'])) $this->caption = $o['caption'];
        if (isset($o['rel'])) $this->rel = $o['rel'];
        if (isset($o['hRef'])) $this->hRef = $o['hRef'];
        if (isset($o['method'])) $this->method = $o['method'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->caption)) $o['caption'] = $this->caption;
        if (isset($this->rel)) $o['rel'] = $this->rel;
        if (isset($this->hRef)) $o['hRef'] = $this->hRef;
        if (isset($this->method)) $o['method'] = $this->method;
        return empty($o) ? new class(){} : $o;
    }
}

class ConfigItemDto implements IConfigItem, JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $name='',
        /** @var string */
        public string $displayName='',
        /** @var string|null */
        public ?string $description=null,
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null,
        /** @var string */
        public string $selfLink='',
        /** @var array<TagDto>|null */
        public ?array $tags=null,
        /** @var array<PathItemDto>|null */
        public ?array $path=null,
        /** @var DateTime */
        public DateTime $created=new DateTime(),
        /** @var string */
        public string $createUser='',
        /** @var string */
        public string $createUserId='',
        /** @var DateTime */
        public DateTime $modified=new DateTime(),
        /** @var string */
        public string $modifyUser='',
        /** @var string */
        public string $modifyUserId='',
        /** @var bool|null */
        public ?bool $isDeleted=null,
        /** @var DateTime|null */
        public ?DateTime $deleted=null,
        /** @var string|null */
        public ?string $deleteUser=null,
        /** @var string|null */
        public ?string $deleteUserId=null,
        /** @var array<LinkDto>|null */
        public ?array $links=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['description'])) $this->description = $o['description'];
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
        if (isset($o['selfLink'])) $this->selfLink = $o['selfLink'];
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('TagDto', $o['tags']);
        if (isset($o['path'])) $this->path = JsonConverters::fromArray('PathItemDto', $o['path']);
        if (isset($o['created'])) $this->created = JsonConverters::from('DateTime', $o['created']);
        if (isset($o['createUser'])) $this->createUser = $o['createUser'];
        if (isset($o['createUserId'])) $this->createUserId = $o['createUserId'];
        if (isset($o['modified'])) $this->modified = JsonConverters::from('DateTime', $o['modified']);
        if (isset($o['modifyUser'])) $this->modifyUser = $o['modifyUser'];
        if (isset($o['modifyUserId'])) $this->modifyUserId = $o['modifyUserId'];
        if (isset($o['isDeleted'])) $this->isDeleted = $o['isDeleted'];
        if (isset($o['deleted'])) $this->deleted = JsonConverters::from('DateTime', $o['deleted']);
        if (isset($o['deleteUser'])) $this->deleteUser = $o['deleteUser'];
        if (isset($o['deleteUserId'])) $this->deleteUserId = $o['deleteUserId'];
        if (isset($o['links'])) $this->links = JsonConverters::fromArray('LinkDto', $o['links']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->description)) $o['description'] = $this->description;
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        if (isset($this->selfLink)) $o['selfLink'] = $this->selfLink;
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('TagDto', $this->tags);
        if (isset($this->path)) $o['path'] = JsonConverters::toArray('PathItemDto', $this->path);
        if (isset($this->created)) $o['created'] = JsonConverters::to('DateTime', $this->created);
        if (isset($this->createUser)) $o['createUser'] = $this->createUser;
        if (isset($this->createUserId)) $o['createUserId'] = $this->createUserId;
        if (isset($this->modified)) $o['modified'] = JsonConverters::to('DateTime', $this->modified);
        if (isset($this->modifyUser)) $o['modifyUser'] = $this->modifyUser;
        if (isset($this->modifyUserId)) $o['modifyUserId'] = $this->modifyUserId;
        if (isset($this->isDeleted)) $o['isDeleted'] = $this->isDeleted;
        if (isset($this->deleted)) $o['deleted'] = JsonConverters::to('DateTime', $this->deleted);
        if (isset($this->deleteUser)) $o['deleteUser'] = $this->deleteUser;
        if (isset($this->deleteUserId)) $o['deleteUserId'] = $this->deleteUserId;
        if (isset($this->links)) $o['links'] = JsonConverters::toArray('LinkDto', $this->links);
        return empty($o) ? new class(){} : $o;
    }
}

enum ActionScopes : string
{
    case Deployment = 'Deployment';
    case ResourceGroup = 'ResourceGroup';
    case Resource = 'Resource';
}

class ActionStepDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $name='',
        /** @var string|null */
        public ?string $displayName=null,
        /** @description The variables which are used in the ansible job */
        /** @var array<string,Object>|null */
        public ?array $variables=null,
        /** @description Optional credential to be used in awx (credential stored in awx) */
        /** @var string|null */
        public ?string $credential=null,
        /** @description Ansible limit (optional if Scope is Resource) */
        /** @var string|null */
        public ?string $limit=null,
        /** @description Optional type of the awx action to run (job, workflow, etc.) */
        /** @var string|null */
        public ?string $type=null,
        /** @description Optional ansible module to be used */
        /** @var string|null */
        public ?string $module=null,
        /** @description Optional image for the execution environment which runs the action */
        /** @var string|null */
        public ?string $executionEnvironment=null,
        /** @description Optional inventory */
        /** @var string|null */
        public ?string $inventory=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['variables'])) $this->variables = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $o['variables']);
        if (isset($o['credential'])) $this->credential = $o['credential'];
        if (isset($o['limit'])) $this->limit = $o['limit'];
        if (isset($o['type'])) $this->type = $o['type'];
        if (isset($o['module'])) $this->module = $o['module'];
        if (isset($o['executionEnvironment'])) $this->executionEnvironment = $o['executionEnvironment'];
        if (isset($o['inventory'])) $this->inventory = $o['inventory'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->variables)) $o['variables'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','Object']), $this->variables);
        if (isset($this->credential)) $o['credential'] = $this->credential;
        if (isset($this->limit)) $o['limit'] = $this->limit;
        if (isset($this->type)) $o['type'] = $this->type;
        if (isset($this->module)) $o['module'] = $this->module;
        if (isset($this->executionEnvironment)) $o['executionEnvironment'] = $this->executionEnvironment;
        if (isset($this->inventory)) $o['inventory'] = $this->inventory;
        return empty($o) ? new class(){} : $o;
    }
}

class ActionDto extends ConfigItemDto implements IHasTenantId, JsonSerializable
{
    /**
     * @param string $id
     * @param string $name
     * @param string $displayName
     * @param string|null $description
     * @param ObjectTypes|null $objectType
     * @param string $selfLink
     * @param array<TagDto>|null $tags
     * @param array<PathItemDto>|null $path
     * @param DateTime $created
     * @param string $createUser
     * @param string $createUserId
     * @param DateTime $modified
     * @param string $modifyUser
     * @param string $modifyUserId
     * @param bool|null $isDeleted
     * @param DateTime|null $deleted
     * @param string|null $deleteUser
     * @param string|null $deleteUserId
     * @param array<LinkDto>|null $links
     */
    public function __construct(
        string $id='',
        string $name='',
        string $displayName='',
        ?string $description=null,
        ?ObjectTypes $objectType=null,
        string $selfLink='',
        ?array $tags=null,
        ?array $path=null,
        DateTime $created=new DateTime(),
        string $createUser='',
        string $createUserId='',
        DateTime $modified=new DateTime(),
        string $modifyUser='',
        string $modifyUserId='',
        ?bool $isDeleted=null,
        ?DateTime $deleted=null,
        ?string $deleteUser=null,
        ?string $deleteUserId=null,
        ?array $links=null,
        /** @var string */
        public string $tenantId='',
        /** @description The schema version of the attached definition (json/yaml structure) */
        /** @var int */
        public int $schemaVersion=0,
        /** @description The action definition as json/yaml */
        /** @var string|null */
        public ?string $definition=null,
        /** @description Action parameters */
        /** @var array<ParameterDto>|null */
        public ?array $parameters=null,
        /** @description Disabled actions cannot be assigned to a configitem */
        /** @var bool|null */
        public ?bool $isDisabled=null,
        /** @description This action can anly be assigned to configitems of this type */
        /** @var ActionScopes|null */
        public ?ActionScopes $scope=null,
        /** @description The individual steps of the action */
        /** @var array<ActionStepDto>|null */
        public ?array $steps=null
    ) {
        parent::__construct($id,$name,$displayName,$description,$objectType,$selfLink,$tags,$path,$created,$createUser,$createUserId,$modified,$modifyUser,$modifyUserId,$isDeleted,$deleted,$deleteUser,$deleteUserId,$links);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['tenantId'])) $this->tenantId = $o['tenantId'];
        if (isset($o['schemaVersion'])) $this->schemaVersion = $o['schemaVersion'];
        if (isset($o['definition'])) $this->definition = $o['definition'];
        if (isset($o['parameters'])) $this->parameters = JsonConverters::fromArray('ParameterDto', $o['parameters']);
        if (isset($o['isDisabled'])) $this->isDisabled = $o['isDisabled'];
        if (isset($o['scope'])) $this->scope = JsonConverters::from('ActionScopes', $o['scope']);
        if (isset($o['steps'])) $this->steps = JsonConverters::fromArray('ActionStepDto', $o['steps']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->tenantId)) $o['tenantId'] = $this->tenantId;
        if (isset($this->schemaVersion)) $o['schemaVersion'] = $this->schemaVersion;
        if (isset($this->definition)) $o['definition'] = $this->definition;
        if (isset($this->parameters)) $o['parameters'] = JsonConverters::toArray('ParameterDto', $this->parameters);
        if (isset($this->isDisabled)) $o['isDisabled'] = $this->isDisabled;
        if (isset($this->scope)) $o['scope'] = JsonConverters::to('ActionScopes', $this->scope);
        if (isset($this->steps)) $o['steps'] = JsonConverters::toArray('ActionStepDto', $this->steps);
        return empty($o) ? new class(){} : $o;
    }
}

class ScheduledTaskAssignmentDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $configItemId='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null,
        /** @var string */
        public string $displayName='',
        /** @var int */
        public int $taskId=0,
        /** @var string */
        public string $taskName='',
        /** @var string */
        public string $cronExpression=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['configItemId'])) $this->configItemId = $o['configItemId'];
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
        if (isset($o['displayName'])) $this->displayName = $o['displayName'];
        if (isset($o['taskId'])) $this->taskId = $o['taskId'];
        if (isset($o['taskName'])) $this->taskName = $o['taskName'];
        if (isset($o['cronExpression'])) $this->cronExpression = $o['cronExpression'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->configItemId)) $o['configItemId'] = $this->configItemId;
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        if (isset($this->displayName)) $o['displayName'] = $this->displayName;
        if (isset($this->taskId)) $o['taskId'] = $this->taskId;
        if (isset($this->taskName)) $o['taskName'] = $this->taskName;
        if (isset($this->cronExpression)) $o['cronExpression'] = $this->cronExpression;
        return empty($o) ? new class(){} : $o;
    }
}

class ActionAssignmentDto implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $id='',
        /** @var string */
        public string $name='',
        /** @var string */
        public string $actionId='',
        /** @var ActionDto|null */
        public ?ActionDto $action=null,
        /** @var string */
        public string $configItemId='',
        /** @var string */
        public string $configItemName='',
        /** @var ObjectTypes|null */
        public ?ObjectTypes $configItemType=null,
        /** @var array<ParameterDto>|null */
        public ?array $parameters=null,
        /** @var string */
        public string $selfLink='',
        /** @var ActionScopes|null */
        public ?ActionScopes $scope=null,
        /** @var string|null */
        public ?string $cronExpression=null,
        /** @var array<LinkDto>|null */
        public ?array $links=null,
        /** @var string|null */
        public ?string $scheduledTaskAssignmentId=null,
        /** @var ScheduledTaskAssignmentDto|null */
        public ?ScheduledTaskAssignmentDto $scheduledTaskAssignment=null,
        /** @var ObjectTypes|null */
        public ?ObjectTypes $objectType=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['actionId'])) $this->actionId = $o['actionId'];
        if (isset($o['action'])) $this->action = JsonConverters::from('ActionDto', $o['action']);
        if (isset($o['configItemId'])) $this->configItemId = $o['configItemId'];
        if (isset($o['configItemName'])) $this->configItemName = $o['configItemName'];
        if (isset($o['configItemType'])) $this->configItemType = JsonConverters::from('ObjectTypes', $o['configItemType']);
        if (isset($o['parameters'])) $this->parameters = JsonConverters::fromArray('ParameterDto', $o['parameters']);
        if (isset($o['selfLink'])) $this->selfLink = $o['selfLink'];
        if (isset($o['scope'])) $this->scope = JsonConverters::from('ActionScopes', $o['scope']);
        if (isset($o['cronExpression'])) $this->cronExpression = $o['cronExpression'];
        if (isset($o['links'])) $this->links = JsonConverters::fromArray('LinkDto', $o['links']);
        if (isset($o['scheduledTaskAssignmentId'])) $this->scheduledTaskAssignmentId = $o['scheduledTaskAssignmentId'];
        if (isset($o['scheduledTaskAssignment'])) $this->scheduledTaskAssignment = JsonConverters::from('ScheduledTaskAssignmentDto', $o['scheduledTaskAssignment']);
        if (isset($o['objectType'])) $this->objectType = JsonConverters::from('ObjectTypes', $o['objectType']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->actionId)) $o['actionId'] = $this->actionId;
        if (isset($this->action)) $o['action'] = JsonConverters::to('ActionDto', $this->action);
        if (isset($this->configItemId)) $o['configItemId'] = $this->configItemId;
        if (isset($this->configItemName)) $o['configItemName'] = $this->configItemName;
        if (isset($this->configItemType)) $o['configItemType'] = JsonConverters::to('ObjectTypes', $this->configItemType);
        if (isset($this->parameters)) $o['parameters'] = JsonConverters::toArray('ParameterDto', $this->parameters);
        if (isset($this->selfLink)) $o['selfLink'] = $this->selfLink;
        if (isset($this->scope)) $o['scope'] = JsonConverters::to('ActionScopes', $this->scope);
        if (isset($this->cronExpression)) $o['cronExpression'] = $this->cronExpression;
        if (isset($this->links)) $o['links'] = JsonConverters::toArray('LinkDto', $this->links);
        if (isset($this->scheduledTaskAssignmentId)) $o['scheduledTaskAssignmentId'] = $this->scheduledTaskAssignmentId;
        if (isset($this->scheduledTaskAssignment)) $o['scheduledTaskAssignment'] = JsonConverters::to('ScheduledTaskAssignmentDto', $this->scheduledTaskAssignment);
        if (isset($this->objectType)) $o['objectType'] = JsonConverters::to('ObjectTypes', $this->objectType);
        return empty($o) ? new class(){} : $o;
    }
}

PHP CreateActionAssignment DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /api/action-assignments HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tenantName":"String","configItemId":"00000000-0000-0000-0000-000000000000","configItemType":"None","actionId":"00000000-0000-0000-0000-000000000000","name":"String","parameters":[{"name":"String","description":"String","value":"String","default":"String","optional":false,"type":"String","validation":"String"}],"cronExpression":"String","sendNotifications":false,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","name":"String","actionId":"00000000-0000-0000-0000-000000000000","action":{"tenantId":"00000000-0000-0000-0000-000000000000","schemaVersion":0,"definition":"String","parameters":null,"isDisabled":false,"scope":"Deployment","steps":[{"name":"String","displayName":"String","variables":{"String":{}},"credential":"String","limit":"String","type":"String","module":"String","executionEnvironment":"String","inventory":"String"}],"id":"00000000-0000-0000-0000-000000000000","name":"String","displayName":"String","description":"String","objectType":"None","selfLink":"String","tags":null,"path":null,"created":"0001-01-01T00:00:00.0000000Z","createUser":"String","createUserId":"String","modified":"0001-01-01T00:00:00.0000000Z","modifyUser":"String","modifyUserId":"String","isDeleted":false,"deleted":"0001-01-01T00:00:00.0000000Z","deleteUser":"String","deleteUserId":"String","links":null},"configItemId":"00000000-0000-0000-0000-000000000000","configItemName":"String","configItemType":"None","parameters":[{"name":"String","description":"String","value":"String","default":"String","optional":false,"type":"String","validation":"String"}],"selfLink":"String","scope":"Deployment","cronExpression":"String","links":[{"caption":"Start","rel":"start","hRef":"/action-assignments/00000000-0000-0000-0000-000000000000/start","method":"POST"},{"caption":"Completed","rel":"completed","hRef":"/action-assignments/00000000-0000-0000-0000-000000000000/completed","method":"PATCH"}],"scheduledTaskAssignmentId":"00000000-0000-0000-0000-000000000000","scheduledTaskAssignment":{"id":"00000000-0000-0000-0000-000000000000","configItemId":"00000000-0000-0000-0000-000000000000","objectType":"None","displayName":"String","taskId":0,"taskName":"String","cronExpression":"String"},"objectType":"ActionAssignment"}