The Client for Go for use with Citrix DaaS™ APIs enables managing Citrix DaaS resources programmatically in applications written in the Go programming language.
- From GitHub
go get github.com/citrix/citrix-daas-rest-go
- Enable optional remote PoSH on the storefront server
Enable-PSRemoting -Force
Install goimports and Make.
Windows (using Chocolatey):
go install golang.org/x/tools/cmd/goimports@latest
[Environment]::SetEnvironmentVariable('Path',($env:Path -like "*$env:USERPROFILE\go\bin*")?$($env:Path):$env:Path+";$env:USERPROFILE\go\bin",'User') # ensure go is in user's path for goimports
choco install -y makeLinux (Ubuntu/Debian):
go install golang.org/x/tools/cmd/goimports@latest
sudo apt-get install -y makeThis project includes a GNUmakefile for common development tasks:
# Run format, build, and test (default)
make
# Format code with gofmt and goimports
make fmt
# Build all packages
make build
# Run all tests
make test
# Clean build artifacts
make clean
# Show all available commands
make helpThe Client for Go for use with Citrix DaaS APIs contains the following packages:
github.com/citrix/citrix-daas-rest-go/citrixorchestration: SDK which contains the client model and api functions for Citrix DaaS API. This is auto-generated by OpenAPI Generator and do not require any manual changes.github.com/citrix/citrix-daas-rest-go/client: Rest client configurable with Citrix DaaS customer details and handles authentication.github.com/citrix/citrix-daas-rest-go/citrixstorefront: SDK which contains the client model and PowerShell SDK functions for Citrix StoreFront Server. This interacts with PowerShell on the StoreFront server either locally or via Remote PowerShell.github.com/citrix/citrix-daas-rest-go/ccresourcelocations: SDK which contains the client model and api functions for Citrix Resource Locations API. This is auto-generated by OpenAPI Generator and do not require any manual changes.github.com/citrix/citrix-daas-rest-go/globalappconfiguration: SDK which contains the client model and api functions for Citrix Global App Configuration Service API. This is auto-generated by OpenAPI Generator and do not require any manual changes.github.com/citrix/citrix-daas-rest-go/citrixquickcreate: SDK which contains the client model and api functions for Citrix Quick Create Service API. This is auto-generated by OpenAPI Generator, however it has known issue where the "bytes" and "fmt" imports are unused and not removed by the generator. This requires a manual find and replace inside the "citrixquickcreate" folder.github.com/citrix/citrix-daas-rest-go/citrixcws: SDK which contains the client model and api functions for Citrix Cloud CWS Service API. This is auto-generated by OpenAPI Generator and do not require any manual changes.github.com/citrix/citrix-daas-rest-go/devicemanagement: SDK which contains the client model and api functions for Citrix Workspace Environment Management. This is auto-generated by OpenAPI Generator and do not require any manual changes.
Instantiate a client using NewCitrixDaasClient. The following variables are required to configure Citrix DaaS client:
| Cloud | On-Premises | |
|---|---|---|
| authUrl | Citrix Cloud authentication URL, i.e. https://api-us.cloud.com/cctrustoauth2/{customerId}/tokens/clients for US customers. |
On-Premises trust service URL, i.e. https://{deliveryControllerHostname}/citrix/orchestration/api/tokens |
| hostname | Citrix Cloud DaaS service hostname, i.e. {customerId}.xendesktop.net |
Delivery Controller Hostname / IP address |
| customerId | Cloud Customer Id | CitrixOnPremises |
| clientId | Citrix Cloud API Key clientId | Domain Admin Username |
| clientSecret | Citrix Cloud API Key clientSecret | Domain Admin Password |
| onPremise | false |
true |
| ccUrl | Citrix Cloud URL, i.e. https://api.cloud.com |
Not Supported |
package main
import (
"context"
citrixstorefront "github.com/citrix/citrix-daas-rest-go/citrixstorefront/models"
citrixorchestration "github.com/citrix/citrix-daas-rest-go/citrixorchestration"
citrixclient "github.com/citrix/citrix-daas-rest-go/client"
)
func main() {
// Create a new Citrix API client for cloud customer 83czxoqlpepv
authUrl := "https://api-us.cloud.com/cctrustoauth2/83czxoqlpepv/tokens/clients"
hostname := "83czxoqlpepv.xendesktop.net"
customerId := "83czxoqlpepv"
clientId := "{apiKeyClientId}"
clientSecret := "{apiKeyClientSecret}"
onPremise := false
ccUrl := https://api.cloud.com
client, err := citrixclient.NewCitrixDaasClient(authUrl, ccUrl, hostname, customerId, clientId, clientSecret, onPremise, nil, nil)
// Optional configuration for storefront client
computerName := "{Storefront Server FQDN}"
sfadUserName := "{AD username}"
sfadUserPass := "{AD password}"
sfclient, err := citrixclient.NewStoreFrontClient(computerName, sfadUserName, sfadUserPass, client)
/************* citrixorchestration client example *************/
// Create GET zone request with zoneId and siteId
zoneId := "8994379b-8585-4717-9765-632992e738d3"
siteId := "8509b2e6-ff02-48bb-aaa3-07b84f09b9f4"
getZoneRequest := client.ApiClient.ZonesTPApi.ZonesTPGetZone(ctx, zoneId, customerId, siteId)
// Get bearer token and put into authorization header
token, _ := client.SignIn()
getZoneRequest = getZoneRequest.Authorization(token)
// Execute request and get response
zone, _, err := getZoneRequest.Execute()
if err != nil {
return
}
/************* citrixstorefront client example *************/
var body citrixstorefront.CreateSTFDeploymentRequestModel
createDeploymentRequest := client.StorefrontClient.DeploymentSF.STFDeploymentCreateSTFDeployment(ctx, body)
}
The client includes auto-generated mock implementations for all API services, making it easy to write unit tests without requiring actual API connections. Each API service provides:
- Mock implementations of service interfaces
- Request wrapper structs with getter methods for argument matching
- Convenience setup functions to streamline test creation
For detailed information on writing unit tests with mock clients, see the Unit Testing Guide.
# Run all tests
go test -v ./test/...The code in this repository makes use of the following packages:
- OpenAPI Generator (https://github.com/OpenAPITools/openapi-generator)
- Testify (https://github.com/stretchr/testify)
This project is Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright © 2026. Citrix Systems, Inc.