CoreService

<back to all web services

GetAction

Action - CRUD

Returns an action by its id

Requires Authentication
Required role:TenantReader
The following routes are available for this service:
All Verbs/api/actions/{Id}
All Verbs/actions/{Id}
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using CoreService.ServiceModel.Dtos.Actions.Crud;
using CoreService.ServiceModel.Dtos.Actions.Responses;
using CoreService.ServiceModel.Dtos.Base.Responses;
using YCO.Dune.Models.Enums;
using CoreService.ServiceModel.Enums;

namespace CoreService.ServiceModel.Dtos.Actions.Crud
{
    ///<summary>
    ///Returns an action by its id
    ///</summary>
    [Api(Description="Returns an action by its id")]
    [ApiResponse(Description="Success", IsDefaultResponse=true, ResponseType=typeof(CoreService.ServiceModel.Dtos.Actions.Responses.ActionDto), StatusCode=200)]
    public partial class GetAction
        : IGetSingleRequest, IHasTenantName, IGet
    {
        [ApiMember(DataType="string", Format="guid", IsRequired=true, ParameterType="path")]
        public virtual Guid Id { get; set; }

        [ApiMember(DataType="string", IsRequired=true, ParameterType="header")]
        [Validate("NotEmpty")]
        public virtual string TenantName { get; set; }

        [ApiMember(ParameterType="query", Verb="GET")]
        public virtual bool? IncludeReferencedObjects { get; set; }

        ///<summary>
        ///If true, also soft deleted items will be returned
        ///</summary>
        [ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")]
        public virtual bool? IncludeDeleted { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.Actions.Responses
{
    public partial class ActionDto
        : ConfigItemDto, IHasTenantId
    {
        public virtual Guid TenantId { get; set; }
        ///<summary>
        ///The schema version of the attached definition (json/yaml structure)
        ///</summary>
        public virtual int SchemaVersion { get; set; }
        ///<summary>
        ///The action definition as json/yaml
        ///</summary>
        public virtual string? Definition { get; set; }
        ///<summary>
        ///Action parameters
        ///</summary>
        public virtual IList<ParameterDto> Parameters { get; set; }
        ///<summary>
        ///Disabled actions cannot be assigned to a configitem
        ///</summary>
        public virtual bool IsDisabled { get; set; }
        ///<summary>
        ///This action can anly be assigned to configitems of this type
        ///</summary>
        public virtual ActionScopes Scope { get; set; }
        ///<summary>
        ///The individual steps of the action
        ///</summary>
        public virtual List<ActionStepDto> Steps { get; set; } = [];
    }

    public partial class ActionStepDto
    {
        public virtual string Name { get; set; }
        public virtual string? DisplayName { get; set; }
        ///<summary>
        ///The variables which are used in the ansible job
        ///</summary>
        public virtual Dictionary<string, Object> Variables { get; set; } = new();
        ///<summary>
        ///Optional credential to be used in awx (credential stored in awx)
        ///</summary>
        public virtual string? Credential { get; set; }
        ///<summary>
        ///Ansible limit (optional if Scope is Resource)
        ///</summary>
        public virtual string? Limit { get; set; }
        ///<summary>
        ///Optional type of the awx action to run (job, workflow, etc.)
        ///</summary>
        public virtual string? Type { get; set; }
        ///<summary>
        ///Optional ansible module to be used
        ///</summary>
        public virtual string? Module { get; set; }
        ///<summary>
        ///Optional image for the execution environment which runs the action
        ///</summary>
        public virtual string? ExecutionEnvironment { get; set; }
        ///<summary>
        ///Optional inventory
        ///</summary>
        public virtual string? Inventory { get; set; }
    }

}

namespace CoreService.ServiceModel.Dtos.Base.Responses
{
    public partial class ConfigItemDto
        : IConfigItem
    {
        public virtual Guid Id { get; set; }
        public virtual string Name { get; set; }
        public virtual string DisplayName { get; set; }
        public virtual string? Description { get; set; }
        public virtual ObjectTypes ObjectType { get; set; }
        public virtual string SelfLink { get; set; }
        public virtual IList<TagDto> Tags { get; set; }
        public virtual IList<PathItemDto> Path { get; set; }
        public virtual DateTime Created { get; set; }
        public virtual string CreateUser { get; set; }
        public virtual string CreateUserId { get; set; }
        public virtual DateTime Modified { get; set; }
        public virtual string ModifyUser { get; set; }
        public virtual string ModifyUserId { get; set; }
        public virtual bool IsDeleted { get; set; }
        public virtual DateTime? Deleted { get; set; }
        public virtual string? DeleteUser { get; set; }
        public virtual string? DeleteUserId { get; set; }
        public virtual IList<LinkDto> Links { get; set; }
    }

    public partial class LinkDto
    {
        public virtual string Caption { get; set; }
        public virtual string Rel { get; set; }
        public virtual string HRef { get; set; }
        public virtual string Method { get; set; }
    }

    public partial class ParameterDto
    {
        public virtual string Name { get; set; }
        public virtual string? Description { get; set; }
        ///<summary>
        ///Value in form of a json string (e.g. Number = 1234, String = "foo", Boolean = false). Note: string values need extra quotes
        ///</summary>
        public virtual string? Value { get; set; }
        ///<summary>
        ///Optional default value for the frontend. Needs to be in the same format as the value
        ///</summary>
        public virtual string? Default { get; set; }
        ///<summary>
        ///Optional parameters do not need to have a value. Default -> Optional=false
        ///</summary>
        public virtual bool Optional { get; set; }
        ///<summary>
        ///The data type of the value and default property
        ///</summary>
        public virtual ParameterValueType Type { get; set; }
        public virtual string? Validation { get; set; }
    }

    public partial class PathItemDto
    {
        public virtual string Label { get; set; }
        public virtual string Link { get; set; }
        public virtual ObjectTypes ObjectType { get; set; }
        public virtual Guid ObjectId { get; set; }
    }

    public partial class TagDto
    {
        public virtual string Name { get; set; }
        public virtual string? Value { get; set; }
        public virtual bool IsProtected { get; set; }
    }

}

namespace CoreService.ServiceModel.Enums
{
    public enum ActionScopes
    {
        Deployment,
        ResourceGroup,
        Resource,
    }

    public enum ParameterValueType
    {
        String,
        Number,
        Boolean,
        SecureString,
    }

}

namespace YCO.Dune.Models.Enums
{
    public enum ObjectTypes
    {
        None,
        ConfigItem,
        Tenant,
        Collection,
        Resource,
        ComputeNode,
        VirtualMachine,
        PhysicalMachine,
        Disk,
        Subnet,
        IPAddress,
        Job,
        JobEvent,
        FreezePeriod,
        ResourceGroup,
        Deployment,
        ResourceGroupTemplate,
        DeploymentTemplate,
        ResourceProvider,
        GenericResource,
        Role,
        Permission,
        User,
        PatchingWindow,
        Update,
        ReportDefinition,
        TimeSeries,
        DataPoint,
        Action,
        ActionAssignment,
        UserNote,
    }

}

C# GetAction 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/actions/{Id} HTTP/1.1 
Host: core.starburst.svc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"id":"00000000-0000-0000-0000-000000000000","tenantName":"String","includeReferencedObjects":false,"includeDeleted":false,"txId":"00000000-0000-0000-0000-000000000000"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"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}