Edits history of script submission #18238 for ' Edit a container registry (qovery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Edit a container registry
     *
     */
    export async function main(
    	auth: RT.Qovery,
    	organizationId: string,
    	containerRegistryId: string,
    	body: Body
    ) {
    	const url = new URL(
    		`https://api.qovery.com/organization/${organizationId}/containerRegistry/${containerRegistryId}`
    	)
    
    	const response = await fetch(url, {
    		method: 'PUT',
    		headers: {
    			'Content-Type': 'application/json',
    			Authorization: 'Token ' + auth.apiKey
    		},
    		body: JSON.stringify(body)
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    
    /* eslint-disable */
    /**
     * This file was automatically generated by json-schema-to-typescript.
     * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
     * and run json-schema-to-typescript to regenerate this file.
     */
    
    export interface Body {
    	name: string
    	/**
    	 * The type of your container registry
    	 */
    	kind:
    		| 'ECR'
    		| 'SCALEWAY_CR'
    		| 'DOCKER_HUB'
    		| 'GITHUB_CR'
    		| 'GITHUB_ENTERPRISE_CR'
    		| 'GITLAB_CR'
    		| 'PUBLIC_ECR'
    		| 'DOCR'
    		| 'GENERIC_CR'
    		| 'GCP_ARTIFACT_REGISTRY'
    		| 'AZURE_CR'
    	description?: string
    	/**
    	 * URL of the container registry:
    	 * * For `DOCKER_HUB`: it must be `https://docker.io` (default with 'https://docker.io' if no url provided for `DOCKER_HUB`)
    	 * * For `GITHUB_CR`: it must be `https://ghcr.io` (default with 'https://ghcr.io' if no url provided for `GITHUB_CR`)
    	 * * For `GITLAB_CR`: it must be `https://registry.gitlab.com` (default with 'https://registry.gitlab.com' if no url provided for `GITLAB_CR`)
    	 * * For others: it's required and must start by `https://`
    	 *
    	 */
    	url?: string
    	/**
    	 * This field is dependent of the container registry kind:
    	 * * `ECR` needs in the config: region, access_key_id, secret_access_key
    	 * * `SCALEWAY_CR` needs in the config: region, scaleway_access_key, scaleway_secret_key
    	 * * `GCP_ARTIFACT_REGISTRY` needs in the config: region, json_credentials
    	 * * `DOCKER_HUB` needs in the config (optional): username, password
    	 * * `GITHUB_CR` needs in the config (optional): username, password
    	 * * `GITLAB_CR` needs in the config (optional): username, password
    	 * * `PUBLIC_ECR` doesn't need credentials info
    	 * * `GENERIC_CR` needs in the config (optional): username, password
    	 * * `DOCR` is not supported anymore
    	 *
    	 */
    	config: {
    		/**
    		 * Required if kind is `ECR` or `PUBLIC_ECR`
    		 */
    		access_key_id?: string
    		/**
    		 * Required if kind is `ECR` or `PUBLIC_ECR`
    		 */
    		secret_access_key?: string
    		/**
    		 * Required if kind is `ECR` or `SCALEWAY_CR`
    		 */
    		region?: string
    		/**
    		 * Required if kind is `SCALEWAY_CR`
    		 */
    		scaleway_access_key?: string
    		/**
    		 * Required if kind is `SCALEWAY_CR`
    		 */
    		scaleway_secret_key?: string
    		/**
    		 * Required if kind is `SCALEWAY_CR`
    		 */
    		scaleway_project_id?: string
    		/**
    		 * Required if kind is `GCP_ARTIFACT_REGISTRY`
    		 */
    		json_credentials?: string
    		/**
    		 * optional, for kind `DOCKER_HUB`
    		 * We encourage you to set credentials for Docker Hub due to the limits on the pull rate
    		 *
    		 */
    		username?: string
    		/**
    		 * optional, for kind `DOCKER_HUB`
    		 * We encourage you to set credentials for Docker Hub due to the limits on the pull rate
    		 *
    		 */
    		password?: string
    		/**
    		 * For ECR, you can either set a static access_key or use a role arn that we are going to assume
    		 */
    		role_arn?: string
    		/**
    		 * Required if kind is `AZURE_CR`.
    		 */
    		azure_tenant_id?: string
    		/**
    		 * Required if kind is `AZURE_CR`.
    		 */
    		azure_subscription_id?: string
    		[k: string]: unknown
    	}
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago