/* tslint:disable */
/* eslint-disable */
/**
 * AutoGlue API
 * API for managing K3s clusters across cloud providers
 *
 * The version of the OpenAPI document: dev
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { mapValues } from "../runtime";
/**
 *
 * @export
 * @interface DtoCreateCredentialRequest
 */
export interface DtoCreateCredentialRequest {
  /**
   *
   * @type {string}
   * @memberof DtoCreateCredentialRequest
   */
  account_id?: string;
  /**
   *
   * @type {string}
   * @memberof DtoCreateCredentialRequest
   */
  credential_provider: DtoCreateCredentialRequestCredentialProviderEnum;
  /**
   * aws_access_key, api_token, basic_auth, oauth2
   * @type {string}
   * @memberof DtoCreateCredentialRequest
   */
  kind: string;
  /**
   * human label
   * @type {string}
   * @memberof DtoCreateCredentialRequest
   */
  name?: string;
  /**
   *
   * @type {string}
   * @memberof DtoCreateCredentialRequest
   */
  region?: string;
  /**
   * secret schema version
   * @type {number}
   * @memberof DtoCreateCredentialRequest
   */
  schema_version: number;
  /**
   * {"service":"route53"} or {"arn":"..."}
   * @type {object}
   * @memberof DtoCreateCredentialRequest
   */
  scope: object;
  /**
   *
   * @type {string}
   * @memberof DtoCreateCredentialRequest
   */
  scope_kind: DtoCreateCredentialRequestScopeKindEnum;
  /**
   * scope schema version
   * @type {number}
   * @memberof DtoCreateCredentialRequest
   */
  scope_version: number;
  /**
   * encrypted later
   * @type {object}
   * @memberof DtoCreateCredentialRequest
   */
  secret: object;
}

/**
 * @export
 */
export const DtoCreateCredentialRequestCredentialProviderEnum = {
  aws: "aws",
  cloudflare: "cloudflare",
  hetzner: "hetzner",
  digitalocean: "digitalocean",
  generic: "generic",
} as const;
export type DtoCreateCredentialRequestCredentialProviderEnum =
  (typeof DtoCreateCredentialRequestCredentialProviderEnum)[keyof typeof DtoCreateCredentialRequestCredentialProviderEnum];

/**
 * @export
 */
export const DtoCreateCredentialRequestScopeKindEnum = {
  credential_provider: "credential_provider",
  service: "service",
  resource: "resource",
} as const;
export type DtoCreateCredentialRequestScopeKindEnum =
  (typeof DtoCreateCredentialRequestScopeKindEnum)[keyof typeof DtoCreateCredentialRequestScopeKindEnum];

/**
 * Check if a given object implements the DtoCreateCredentialRequest interface.
 */
export function instanceOfDtoCreateCredentialRequest(
  value: object,
): value is DtoCreateCredentialRequest {
  if (
    !("credential_provider" in value) ||
    value["credential_provider"] === undefined
  )
    return false;
  if (!("kind" in value) || value["kind"] === undefined) return false;
  if (!("schema_version" in value) || value["schema_version"] === undefined)
    return false;
  if (!("scope" in value) || value["scope"] === undefined) return false;
  if (!("scope_kind" in value) || value["scope_kind"] === undefined)
    return false;
  if (!("scope_version" in value) || value["scope_version"] === undefined)
    return false;
  if (!("secret" in value) || value["secret"] === undefined) return false;
  return true;
}

export function DtoCreateCredentialRequestFromJSON(
  json: any,
): DtoCreateCredentialRequest {
  return DtoCreateCredentialRequestFromJSONTyped(json, false);
}

export function DtoCreateCredentialRequestFromJSONTyped(
  json: any,
  ignoreDiscriminator: boolean,
): DtoCreateCredentialRequest {
  if (json == null) {
    return json;
  }
  return {
    account_id: json["account_id"] == null ? undefined : json["account_id"],
    credential_provider: json["credential_provider"],
    kind: json["kind"],
    name: json["name"] == null ? undefined : json["name"],
    region: json["region"] == null ? undefined : json["region"],
    schema_version: json["schema_version"],
    scope: json["scope"],
    scope_kind: json["scope_kind"],
    scope_version: json["scope_version"],
    secret: json["secret"],
  };
}

export function DtoCreateCredentialRequestToJSON(
  json: any,
): DtoCreateCredentialRequest {
  return DtoCreateCredentialRequestToJSONTyped(json, false);
}

export function DtoCreateCredentialRequestToJSONTyped(
  value?: DtoCreateCredentialRequest | null,
  ignoreDiscriminator: boolean = false,
): any {
  if (value == null) {
    return value;
  }

  return {
    account_id: value["account_id"],
    credential_provider: value["credential_provider"],
    kind: value["kind"],
    name: value["name"],
    region: value["region"],
    schema_version: value["schema_version"],
    scope: value["scope"],
    scope_kind: value["scope_kind"],
    scope_version: value["scope_version"],
    secret: value["secret"],
  };
}
