// Module included in the following assemblies:
//
// * cli_reference/openshift_cli/developer-cli-commands.adoc

[id="cli-advanced-developer-commands_{context}"]
= Advanced developer CLI commands

== api-resources

Display the full list of API resources that the server supports.

.Example: List the supported API resources
[source,terminal]
----
$ oc api-resources
----

== api-versions

Display the full list of API versions that the server supports.

.Example: List the supported API versions
[source,terminal]
----
$ oc api-versions
----

== auth

Inspect permissions and reconcile RBAC roles.

.Example: Check whether the current user can read pod logs
[source,terminal]
----
$ oc auth can-i get pods --subresource=log
----

.Example: Reconcile RBAC roles and permissions from a file
[source,terminal]
----
$ oc auth reconcile -f policy.json
----

== cluster-info

Display the address of the master and cluster services.

.Example: Display cluster information
[source,terminal]
----
$ oc cluster-info
----

== convert

Convert a YAML or JSON configuration file to a different API version and print
to standard output (stdout).

.Example: Convert `pod.yaml` to the latest version
[source,terminal]
----
$ oc convert -f pod.yaml
----

== extract

Extract the contents of a config map or secret. Each key in the config map or
secret is created as a separate file with the name of the key.

.Example: Download the contents of the `ruby-1-ca` config map to the current directory
[source,terminal]
----
$ oc extract configmap/ruby-1-ca
----

.Example: Print the contents of the `ruby-1-ca` config map to stdout
[source,terminal]
----
$ oc extract configmap/ruby-1-ca --to=-
----

== idle

Idle scalable resources. An idled service will automatically become unidled when
it receives traffic or it can be manually unidled using the `oc scale` command.

.Example: Idle the `ruby-app` service
[source,terminal]
----
$ oc idle ruby-app
----

== image

Manage images in your {product-title} cluster.

.Example: Copy an image to another tag
[source,terminal]
----
$ oc image mirror myregistry.com/myimage:latest myregistry.com/myimage:stable
----

== observe

Observe changes to resources and take action on them.

.Example: Observe changes to services
[source,terminal]
----
$ oc observe services
----

== patch

Updates one or more fields of an object using strategic merge patch in JSON or
YAML format.

.Example: Update the `spec.unschedulable` field for node `node1` to `true`
[source,terminal]
----
$ oc patch node/node1 -p '{"spec":{"unschedulable":true}}'
----

[NOTE]
====
If you must patch a custom resource definition, you must include the
`--type merge` option in the command.
====

== policy

Manage authorization policies.

.Example: Add the `edit` role to `user1` for the current project
[source,terminal]
----
$ oc policy add-role-to-user edit user1
----

== process

Process a template into a list of resources.

.Example: Convert `template.json` to a resource list and pass to `oc create`
[source,terminal]
----
$ oc process -f template.json | oc create -f -
----

== registry

Manage the integrated registry on {product-title}.

.Example: Display information about the integrated registry
[source,terminal]
----
$ oc registry info
----

== replace

Modify an existing object based on the contents of the specified configuration
file.

.Example: Update a pod using the content in `pod.json`
[source,terminal]
----
$ oc replace -f pod.json
----
