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
The 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 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 © 2024. Citrix Systems, Inc.