| Required role: | TenantReader |
| GET | /api/resourceproviders/{Id} | Returns a resourceprovider | |
|---|---|---|---|
| GET | /resourceproviders/{Id} | Returns a resourceprovider |
import Foundation
import ServiceStack
/**
* Returns a single resourceprovider by its id
*/
// @Api(Description="Returns a single resourceprovider by its id")
// @ApiResponse(Description="The request endend successful", IsDefaultResponse=true, ResponseType=typeof(ResourceProviderDto), StatusCode=200)
public class GetResourceProvider : IGetSingleRequest, IHasId, IHasTenantName, IGet, Codable
{
/**
* The primary key of every config item
*/
// @ApiMember(DataType="string", Description="The primary key of every config item", Format="guid", IsRequired=true, ParameterType="path")
public var id:String
// @ApiMember(DataType="string", IsRequired=true, ParameterType="header")
// @Validate(Validator="NotEmpty")
public var tenantName:String
/**
* If true, also soft deleted items will be returned
*/
// @ApiMember(Description="If true, also soft deleted items will be returned", ParameterType="query")
public var includeDeleted:Bool?
// @ApiMember(ParameterType="query", Verb="GET")
public var includeReferencedObjects:Bool?
required public init(){}
}
public class ResourceProviderDto : ConfigItemDto, IHasTenantId
{
public var tenantId:String
/**
* If environment cannot be detected while scanning, default environment will be used
*/
public var defaultEnvironment:Environments
/**
* List off all allowed environments for this resource provider
*/
public var allowedEnvironments:IList<Environments>
/**
* Defines the provider type (e.g. Azure, Aws)
*/
public var type:ResourceProviderTypes
/**
* Additional generic data which varies depending on ProviderType
*/
public var config:IList<ProviderConfigEntryDto>
/**
* Disabled ResourceProviders cannot be selected for new deployments
*/
public var isDisabled:Bool
/**
* Shows if a ResourceProvider has been initialized and can accept deployments (resources)
*/
public var isReadyForDeployments:Bool
/**
* The cost for the current month
*/
public var costCurrentMonth:Double
/**
* The cost for the last month
*/
public var costLastMonth:Double
/**
* The cost currency
*/
public var costCurrency:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case tenantId
case defaultEnvironment
case allowedEnvironments
case type
case config
case isDisabled
case isReadyForDeployments
case costCurrentMonth
case costLastMonth
case costCurrency
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
tenantId = try container.decodeIfPresent(String.self, forKey: .tenantId)
defaultEnvironment = try container.decodeIfPresent(Environments.self, forKey: .defaultEnvironment)
allowedEnvironments = try container.decodeIfPresent(IList<Environments>.self, forKey: .allowedEnvironments)
type = try container.decodeIfPresent(ResourceProviderTypes.self, forKey: .type)
config = try container.decodeIfPresent(IList<ProviderConfigEntryDto>.self, forKey: .config)
isDisabled = try container.decodeIfPresent(Bool.self, forKey: .isDisabled)
isReadyForDeployments = try container.decodeIfPresent(Bool.self, forKey: .isReadyForDeployments)
costCurrentMonth = try container.decodeIfPresent(Double.self, forKey: .costCurrentMonth)
costLastMonth = try container.decodeIfPresent(Double.self, forKey: .costLastMonth)
costCurrency = try container.decodeIfPresent(String.self, forKey: .costCurrency)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if tenantId != nil { try container.encode(tenantId, forKey: .tenantId) }
if defaultEnvironment != nil { try container.encode(defaultEnvironment, forKey: .defaultEnvironment) }
if allowedEnvironments != nil { try container.encode(allowedEnvironments, forKey: .allowedEnvironments) }
if type != nil { try container.encode(type, forKey: .type) }
if config != nil { try container.encode(config, forKey: .config) }
if isDisabled != nil { try container.encode(isDisabled, forKey: .isDisabled) }
if isReadyForDeployments != nil { try container.encode(isReadyForDeployments, forKey: .isReadyForDeployments) }
if costCurrentMonth != nil { try container.encode(costCurrentMonth, forKey: .costCurrentMonth) }
if costLastMonth != nil { try container.encode(costLastMonth, forKey: .costLastMonth) }
if costCurrency != nil { try container.encode(costCurrency, forKey: .costCurrency) }
}
}
public class ConfigItemDto : IConfigItem, Codable
{
public var id:String
public var name:String
public var displayName:String
public var Description:String
public var objectType:ObjectTypes
public var selfLink:String
public var tags:IList<TagDto>
public var path:IList<PathItemDto>
public var created:Date
public var createUser:String
public var createUserId:String
public var modified:Date
public var modifyUser:String
public var modifyUserId:String
public var isDeleted:Bool
public var deleted:Date?
public var deleteUser:String
public var deleteUserId:String
public var links:IList<LinkDto>
required public init(){}
}
public enum ObjectTypes : String, Codable
{
case None
case ConfigItem
case Tenant
case Collection
case Resource
case ComputeNode
case VirtualMachine
case PhysicalMachine
case Disk
case Subnet
case IPAddress
case Job
case JobEvent
case FreezePeriod
case ResourceGroup
case Deployment
case ResourceGroupTemplate
case DeploymentTemplate
case ResourceProvider
case GenericResource
case Role
case Permission
case User
case PatchingWindow
case Update
case ReportDefinition
case TimeSeries
case DataPoint
case Action
case ActionAssignment
case UserNote
}
public class TagDto : Codable
{
public var name:String
public var value:String
public var isProtected:Bool
required public init(){}
}
public class PathItemDto : Codable
{
public var label:String
public var link:String
public var objectType:ObjectTypes
public var objectId:String
required public init(){}
}
public class LinkDto : Codable
{
public var caption:String
public var rel:String
public var hRef:String
public var method:String
required public init(){}
}
public enum Environments : String, Codable
{
case Lab
case Poc
case Dev
case Test
case Int
case Uat
case Prod
}
public enum ResourceProviderTypes : String, Codable
{
case Azure
case AmazonWebServices
case GoogleCloudPlatform
case ActiveDirectoryServices
case DomainNameSystem
case SwisscomESC
case AzureKeyVault
}
public class ProviderConfigEntryDto : Codable
{
public var name:String
public var value:String
public var isSecure:Bool
required public init(){}
}
Swift GetResourceProvider 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
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/resourceproviders/{Id} HTTP/1.1
Host: core.starburst.svc
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"tenantId":"00000000-0000-0000-0000-000000000000","defaultEnvironment":"Lab","allowedEnvironments":null,"type":"Azure","config":null,"isDisabled":false,"isReadyForDeployments":false,"costCurrentMonth":0,"costLastMonth":0,"costCurrency":"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}