# cloudfoundry/go-cfclient architecture

> Architecture diagram of the GitHub repository cloudfoundry/go-cfclient, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cloudfoundry/go-cfclient
- Repository: https://github.com/cloudfoundry/go-cfclient

## Overview

go-cfclient is a Go library for interacting with the Cloud Foundry v3 API. A caller configures authentication and API access, creates a client, then uses resource-specific clients to make API requests and receive typed resources or asynchronous job IDs. The library also provides manifest-driven app push/deployment operations, filtering, pagination, and job polling. The graph preserves those documented capabilities; unsampled resource areas use exact enclosing directories, and unverified implementation links are omitted.

Main entry points: [`client/client.go`](https://github.com/cloudfoundry/go-cfclient/blob/main/client/client.go) (Client facade), [`operation/push.go`](https://github.com/cloudfoundry/go-cfclient/blob/main/operation/push.go) (App push workflow), [`client/service_instance.go`](https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_instance.go) (Service instances), [`client/service_plan.go`](https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_plan.go) (Service plans)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Configuration and auth"]
  node_config["Config and auth<br/>[config.go]"]
end

subgraph group_api["API client"]
  node_client["Client facade<br/>[client.go]"]
  node_apps["Applications<br/>[app.go]"]
  node_service_instances["Service instances"]
  node_service_plans["Service plans<br/>[service_plan.go]"]
  node_route_bindings["Service route bindings"]
  node_other_clients["Other resource clients"]
  node_transport["HTTP transport<br/>[client.go]"]
  node_response["Response decoding<br/>[response.go]"]
  node_jobs["Job polling<br/>[job.go]"]
end

subgraph group_operations["App operations"]
  node_manifest["Manifest definitions<br/>[manifest.go]"]
  node_push["App push workflow<br/>[push.go]"]
end

subgraph group_models["Resource models"]
  node_app_resource["App resources<br/>[app.go]"]
  node_service_resources["Service resources"]
  node_other_resources["Other resources"]
end

node_caller(("Library caller"))
node_uaa{{"UAA"}}
node_cf{{"Cloud Controller"}}

node_caller -->|"configures"| node_config
node_caller -->|"creates"| node_client
node_config -->|"authenticates with"| node_uaa
node_client -->|"sends requests"| node_transport
node_transport -.->|"refreshes tokens"| node_uaa
node_caller -->|"requests resources"| node_apps
node_caller -->|"requests resources"| node_service_instances
node_caller -->|"requests resources"| node_service_plans
node_caller -->|"requests resources"| node_route_bindings
node_caller -->|"requests resources"| node_other_clients
node_apps -->|"calls"| node_client
node_service_instances -->|"calls"| node_client
node_service_plans -->|"calls"| node_client
node_route_bindings -->|"calls"| node_client
node_other_clients -.->|"calls"| node_client
node_client -->|"decodes responses"| node_response
node_response -->|"decodes JSON"| node_app_resource
node_service_instances -->|"uses typed resources"| node_service_resources
node_service_plans -->|"uses typed resources"| node_service_resources
node_route_bindings -->|"uses typed resources"| node_service_resources
node_caller -->|"runs push"| node_push
node_push -->|"consumes manifest"| node_manifest
node_push -->|"manages apps"| node_apps
node_push -->|"uses deployment resources"| node_other_clients
node_push -.->|"polls completion"| node_jobs
node_caller -->|"polls jobs"| node_jobs
node_apps -->|"requests API"| node_cf
node_service_instances -->|"requests API"| node_cf
node_service_plans -->|"requests API"| node_cf
node_route_bindings -->|"requests API"| node_cf
node_other_clients -.->|"requests API"| node_cf
node_push -.->|"deploys applications"| node_cf

click node_config "https://github.com/cloudfoundry/go-cfclient/blob/main/config/config.go"
click node_client "https://github.com/cloudfoundry/go-cfclient/blob/main/client/client.go"
click node_apps "https://github.com/cloudfoundry/go-cfclient/blob/main/client/app.go"
click node_service_instances "https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_instance.go"
click node_service_plans "https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_plan.go"
click node_route_bindings "https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_route_binding.go"
click node_other_clients "https://github.com/cloudfoundry/go-cfclient/tree/main/client"
click node_transport "https://github.com/cloudfoundry/go-cfclient/blob/main/internal/http/client.go"
click node_response "https://github.com/cloudfoundry/go-cfclient/blob/main/internal/http/response.go"
click node_manifest "https://github.com/cloudfoundry/go-cfclient/blob/main/operation/manifest.go"
click node_push "https://github.com/cloudfoundry/go-cfclient/blob/main/operation/push.go"
click node_jobs "https://github.com/cloudfoundry/go-cfclient/blob/main/client/job.go"
click node_app_resource "https://github.com/cloudfoundry/go-cfclient/blob/main/resource/app.go"
click node_service_resources "https://github.com/cloudfoundry/go-cfclient/tree/main/resource"
click node_other_resources "https://github.com/cloudfoundry/go-cfclient/tree/main/resource"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_config toneBlue
class node_client,node_apps,node_service_instances,node_service_plans,node_route_bindings,node_other_clients,node_transport,node_response,node_jobs toneAmber
class node_manifest,node_push toneMint
class node_app_resource,node_service_resources,node_other_resources toneRose
class node_caller,node_uaa,node_cf toneIndigo
```

## Components

### Configuration and auth

- [Config and auth](https://github.com/cloudfoundry/go-cfclient/blob/main/config/config.go): `config/config.go`

### API client

- [Client facade](https://github.com/cloudfoundry/go-cfclient/blob/main/client/client.go): `client/client.go`
- [Applications](https://github.com/cloudfoundry/go-cfclient/blob/main/client/app.go): `client/app.go`
- [Service instances](https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_instance.go): `client/service_instance.go`
- [Service plans](https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_plan.go): `client/service_plan.go`
- [Service route bindings](https://github.com/cloudfoundry/go-cfclient/blob/main/client/service_route_binding.go): `client/service_route_binding.go`
- [Other resource clients](https://github.com/cloudfoundry/go-cfclient/tree/main/client): `client`
- [HTTP transport](https://github.com/cloudfoundry/go-cfclient/blob/main/internal/http/client.go): `internal/http/client.go`
- [Response decoding](https://github.com/cloudfoundry/go-cfclient/blob/main/internal/http/response.go): `internal/http/response.go`
- [Job polling](https://github.com/cloudfoundry/go-cfclient/blob/main/client/job.go): `client/job.go`

### App operations

- [Manifest definitions](https://github.com/cloudfoundry/go-cfclient/blob/main/operation/manifest.go): `operation/manifest.go`
- [App push workflow](https://github.com/cloudfoundry/go-cfclient/blob/main/operation/push.go): `operation/push.go`

### Resource models

- [App resources](https://github.com/cloudfoundry/go-cfclient/blob/main/resource/app.go): `resource/app.go`
- [Service resources](https://github.com/cloudfoundry/go-cfclient/tree/main/resource): `resource`
- [Other resources](https://github.com/cloudfoundry/go-cfclient/tree/main/resource): `resource`

### Other components

- **Library caller**
- **UAA**
- **Cloud Controller**

## Connections

- Library caller → Config and auth: configures (evidence: `README.md`)
- Library caller → Client facade: creates (evidence: `README.md`)
- Config and auth → UAA: authenticates with (evidence: `README.md`)
- Client facade → HTTP transport: sends requests (evidence: `client/client.go`)
- HTTP transport → UAA: refreshes tokens
- Library caller → Applications: requests resources (evidence: `README.md`)
- Library caller → Service instances: requests resources (evidence: `README.md`)
- Library caller → Service plans: requests resources (evidence: `README.md`)
- Library caller → Service route bindings: requests resources (evidence: `README.md`)
- Library caller → Other resource clients: requests resources (evidence: `README.md`)
- Applications → Client facade: calls (evidence: `client/app.go`)
- Service instances → Client facade: calls (evidence: `client/service_instance.go`)
- Service plans → Client facade: calls (evidence: `client/service_plan.go`)
- Service route bindings → Client facade: calls (evidence: `client/service_route_binding.go`)
- Other resource clients → Client facade: calls
- Client facade → Response decoding: decodes responses (evidence: `client/client.go`)
- Response decoding → App resources: decodes JSON (evidence: `internal/http/response.go`)
- Service instances → Service resources: uses typed resources (evidence: `client/service_instance.go`)
- Service plans → Service resources: uses typed resources (evidence: `client/service_plan.go`)
- Service route bindings → Service resources: uses typed resources (evidence: `client/service_route_binding.go`)
- Library caller → App push workflow: runs push (evidence: `README.md`)
- App push workflow → Manifest definitions: consumes manifest (evidence: `operation/push.go`)
- App push workflow → Applications: manages apps (evidence: `operation/push.go`)
- App push workflow → Other resource clients: uses deployment resources (evidence: `operation/push.go`)
- App push workflow → Job polling: polls completion
- Library caller → Job polling: polls jobs (evidence: `README.md`)
- Applications → Cloud Controller: requests API (evidence: `client/app.go`)
- Service instances → Cloud Controller: requests API (evidence: `client/service_instance.go`)
- Service plans → Cloud Controller: requests API (evidence: `client/service_plan.go`)
- Service route bindings → Cloud Controller: requests API (evidence: `client/service_route_binding.go`)
- Other resource clients → Cloud Controller: requests API
- App push workflow → Cloud Controller: deploys applications
