//
// This file generated by rdl 1.5.2
//

package zms

import (
	"bytes"
	"encoding/json"
	"fmt"
	rdl "github.com/ardielle/ardielle-go/rdl"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"strconv"
	"strings"
	"time"
)

var _ = json.Marshal
var _ = fmt.Printf
var _ = rdl.BaseTypeAny
var _ = ioutil.NopCloser

type ZMSClient struct {
	URL             string
	Transport       http.RoundTripper
	CredsHeaders    map[string]string
	Timeout         time.Duration
	DisableRedirect bool
}

// NewClient creates and returns a new HTTP client object for the ZMS service
func NewClient(url string, transport http.RoundTripper) ZMSClient {
	return ZMSClient{url, transport, make(map[string]string), 0, false}
}

// AddCredentials adds the credentials to the client for subsequent requests.
func (client *ZMSClient) AddCredentials(header string, token string) {
	client.CredsHeaders[header] = token
}

func (client ZMSClient) getClient() *http.Client {
	var c *http.Client
	if client.Transport != nil {
		c = &http.Client{Transport: client.Transport}
	} else {
		c = &http.Client{}
	}
	if client.DisableRedirect {
		c.CheckRedirect = func(req *http.Request, via []*http.Request) error {
			return http.ErrUseLastResponse
		}
	}
	if client.Timeout > 0 {
		c.Timeout = client.Timeout
	}
	return c
}

func (client ZMSClient) addAuthHeader(req *http.Request) {
	if len(client.CredsHeaders) == 0 {
		return
	}
	for key, value := range client.CredsHeaders {
		if strings.HasPrefix(key, "Cookie.") {
			req.Header.Add("Cookie", (key)[7:]+"="+value)
		} else {
			req.Header.Add(key, value)
		}
	}
}

func (client ZMSClient) httpGet(url string, headers map[string]string) (*http.Response, error) {
	hclient := client.getClient()
	req, err := http.NewRequest("GET", url, nil)
	if err != nil {
		return nil, err
	}
	client.addAuthHeader(req)
	if headers != nil {
		for k, v := range headers {
			req.Header.Add(k, v)
		}
	}
	return hclient.Do(req)
}

func (client ZMSClient) httpDelete(url string, headers map[string]string) (*http.Response, error) {
	hclient := client.getClient()
	req, err := http.NewRequest("DELETE", url, nil)
	if err != nil {
		return nil, err
	}
	client.addAuthHeader(req)
	if headers != nil {
		for k, v := range headers {
			req.Header.Add(k, v)
		}
	}
	return hclient.Do(req)
}

func (client ZMSClient) httpPut(url string, headers map[string]string, body []byte) (*http.Response, error) {
	var contentReader io.Reader
	if body != nil {
		contentReader = bytes.NewReader(body)
	}
	hclient := client.getClient()
	req, err := http.NewRequest("PUT", url, contentReader)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Content-type", "application/json")
	client.addAuthHeader(req)
	if headers != nil {
		for k, v := range headers {
			req.Header.Add(k, v)
		}
	}
	return hclient.Do(req)
}

func (client ZMSClient) httpPostWithContentType(url string, headers map[string]string, body []byte, contentType string) (*http.Response, error) {
	var contentReader io.Reader
	if body != nil {
		contentReader = bytes.NewReader(body)
	}
	hclient := client.getClient()
	req, err := http.NewRequest("POST", url, contentReader)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Content-type", contentType)
	client.addAuthHeader(req)
	if headers != nil {
		for k, v := range headers {
			req.Header.Add(k, v)
		}
	}
	return hclient.Do(req)
}

func (client ZMSClient) httpPost(url string, headers map[string]string, body []byte) (*http.Response, error) {
	return client.httpPostWithContentType(url, headers, body, "application/json")
}

func (client ZMSClient) httpPatch(url string, headers map[string]string, body []byte) (*http.Response, error) {
	var contentReader io.Reader
	if body != nil {
		contentReader = bytes.NewReader(body)
	}
	hclient := client.getClient()
	req, err := http.NewRequest("PATCH", url, contentReader)
	if err != nil {
		return nil, err
	}
	req.Header.Add("Content-type", "application/json")
	client.addAuthHeader(req)
	if headers != nil {
		for k, v := range headers {
			req.Header.Add(k, v)
		}
	}
	return hclient.Do(req)
}

func (client ZMSClient) httpOptions(url string, headers map[string]string, body []byte) (*http.Response, error) {
	var contentReader io.Reader = nil
	if body != nil {
		contentReader = bytes.NewReader(body)
	}
	hclient := client.getClient()
	req, err := http.NewRequest("OPTIONS", url, contentReader)
	if err != nil {
		return nil, err
	}
	if contentReader != nil {
		req.Header.Add("Content-type", "application/json")
	}
	client.addAuthHeader(req)
	if headers != nil {
		for k, v := range headers {
			req.Header.Add(k, v)
		}
	}
	return hclient.Do(req)
}

func encodeStringParam(name string, val string, def string) string {
	if val == def {
		return ""
	}
	return "&" + name + "=" + url.QueryEscape(val)
}
func encodeBoolParam(name string, b bool, def bool) string {
	if b == def {
		return ""
	}
	return fmt.Sprintf("&%s=%v", name, b)
}
func encodeInt8Param(name string, i int8, def int8) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + strconv.Itoa(int(i))
}
func encodeInt16Param(name string, i int16, def int16) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + strconv.Itoa(int(i))
}
func encodeInt32Param(name string, i int32, def int32) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + strconv.Itoa(int(i))
}
func encodeInt64Param(name string, i int64, def int64) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + strconv.FormatInt(i, 10)
}
func encodeTimestampParam(name string, i rdl.Timestamp, def rdl.Timestamp) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + url.QueryEscape(i.String())
}
func encodeUUIDParam(name string, i rdl.UUID, def rdl.UUID) string {
	if i.Equal(def) {
		return ""
	}
	return "&" + name + "=" + i.String()
}
func encodeFloat32Param(name string, i float32, def float32) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + strconv.FormatFloat(float64(i), 'g', -1, 32)
}
func encodeFloat64Param(name string, i float64, def float64) string {
	if i == def {
		return ""
	}
	return "&" + name + "=" + strconv.FormatFloat(i, 'g', -1, 64)
}
func encodeOptionalEnumParam(name string, e interface{}) string {
	if e == nil {
		return "\"\""
	}
	return fmt.Sprintf("&%s=%v", name, e)
}
func encodeOptionalBoolParam(name string, b *bool) string {
	if b == nil {
		return ""
	}
	return fmt.Sprintf("&%s=%v", name, *b)
}
func encodeOptionalInt32Param(name string, i *int32) string {
	if i == nil {
		return ""
	}
	return "&" + name + "=" + strconv.Itoa(int(*i))
}
func encodeOptionalInt64Param(name string, i *int64) string {
	if i == nil {
		return ""
	}
	return "&" + name + "=" + strconv.Itoa(int(*i))
}
func encodeOptionalTimestampParam(name string, i *rdl.Timestamp) string {
	if i == nil {
		return ""
	}
	return "&" + name + "=" + url.QueryEscape(i.String())
}
func encodeOptionalUUIDParam(name string, i *rdl.UUID) string {
	if i == nil {
		return ""
	}
	return "&" + name + "=" + i.String()
}
func encodeParams(objs ...string) string {
	s := strings.Join(objs, "")
	if s == "" {
		return s
	}
	return "?" + s[1:]
}

func (client ZMSClient) GetDomain(domain DomainName) (*Domain, error) {
	var data *Domain
	url := client.URL + "/domain/" + fmt.Sprint(domain)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetDomainList(limit *int32, skip string, prefix string, depth *int32, account string, productNumber *int32, roleMember ResourceName, roleName ResourceName, subscription string, project string, tagKey TagKey, tagValue TagCompoundValue, businessService string, productId string, modifiedSince string) (*DomainList, error) {
	var data *DomainList
	headers := map[string]string{
		"If-Modified-Since": modifiedSince,
	}
	url := client.URL + "/domain" + encodeParams(encodeOptionalInt32Param("limit", limit), encodeStringParam("skip", string(skip), ""), encodeStringParam("prefix", string(prefix), ""), encodeOptionalInt32Param("depth", depth), encodeStringParam("account", string(account), ""), encodeOptionalInt32Param("ypmid", productNumber), encodeStringParam("member", string(roleMember), ""), encodeStringParam("role", string(roleName), ""), encodeStringParam("azure", string(subscription), ""), encodeStringParam("gcp", string(project), ""), encodeStringParam("tagKey", string(tagKey), ""), encodeStringParam("tagValue", string(tagValue), ""), encodeStringParam("businessService", string(businessService), ""), encodeStringParam("productId", string(productId), ""))
	resp, err := client.httpGet(url, headers)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PostTopLevelDomain(auditRef string, resourceOwner string, detail *TopLevelDomain) (*Domain, error) {
	var data *Domain
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain"
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPost(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PostSubDomain(parent DomainName, auditRef string, resourceOwner string, detail *SubDomain) (*Domain, error) {
	var data *Domain
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/subdomain/" + fmt.Sprint(parent)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPost(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PostUserDomain(name SimpleName, auditRef string, resourceOwner string, detail *UserDomain) (*Domain, error) {
	var data *Domain
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/userdomain/" + fmt.Sprint(name)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPost(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteTopLevelDomain(name SimpleName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteSubDomain(parent DomainName, name SimpleName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/subdomain/" + fmt.Sprint(parent) + "/" + fmt.Sprint(name)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteUserDomain(name SimpleName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/userdomain/" + fmt.Sprint(name)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutDomainMeta(name DomainName, auditRef string, resourceOwner string, detail *DomainMeta) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/meta"
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutDomainSystemMeta(name DomainName, attribute SimpleName, auditRef string, detail *DomainMeta) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/meta/system/" + fmt.Sprint(attribute)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutDomainTemplate(name DomainName, auditRef string, domainTemplate *DomainTemplate) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/template"
	contentBytes, err := json.Marshal(domainTemplate)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutDomainTemplateExt(name DomainName, template SimpleName, auditRef string, domainTemplate *DomainTemplate) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/template/" + fmt.Sprint(template)
	contentBytes, err := json.Marshal(domainTemplate)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetDomainTemplateList(name DomainName) (*DomainTemplateList, error) {
	var data *DomainTemplateList
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/template"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteDomainTemplate(name DomainName, template SimpleName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/template/" + fmt.Sprint(template)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetDomainMetaStoreValidValuesList(attributeName string, userName string) (*DomainMetaStoreValidValuesList, error) {
	var data *DomainMetaStoreValidValuesList
	url := client.URL + "/domain/metastore" + encodeParams(encodeStringParam("attribute", string(attributeName), ""), encodeStringParam("user", string(userName), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetAuthHistoryDependencies(domainName DomainName) (*AuthHistoryDependencies, error) {
	var data *AuthHistoryDependencies
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/history/auth"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteExpiredMembers(purgeResources *int32, auditRef string, returnObj *bool) (*ExpiredMembers, error) {
	var data *ExpiredMembers
	headers := map[string]string{
		"Athenz-Return-Object": strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":          auditRef,
	}
	url := client.URL + "/expired-members" + encodeParams(encodeOptionalInt32Param("purgeResources", purgeResources))
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutResourceDomainOwnership(domainName DomainName, auditRef string, resourceOwnership *ResourceDomainOwnership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/ownership"
	contentBytes, err := json.Marshal(resourceOwnership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetDomainDataCheck(domainName DomainName) (*DomainDataCheck, error) {
	var data *DomainDataCheck
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/check"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutEntity(domainName DomainName, entityName EntityName, auditRef string, entity *Entity) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/entity/" + fmt.Sprint(entityName)
	contentBytes, err := json.Marshal(entity)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetEntity(domainName DomainName, entityName EntityName) (*Entity, error) {
	var data *Entity
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/entity/" + fmt.Sprint(entityName)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteEntity(domainName DomainName, entityName EntityName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/entity/" + fmt.Sprint(entityName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetEntityList(domainName DomainName) (*EntityList, error) {
	var data *EntityList
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/entity"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetRoleList(domainName DomainName, limit *int32, skip string) (*RoleList, error) {
	var data *RoleList
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role" + encodeParams(encodeOptionalInt32Param("limit", limit), encodeStringParam("skip", string(skip), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetRoles(domainName DomainName, members *bool, tagKey TagKey, tagValue TagCompoundValue) (*Roles, error) {
	var data *Roles
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/roles" + encodeParams(encodeOptionalBoolParam("members", members), encodeStringParam("tagKey", string(tagKey), ""), encodeStringParam("tagValue", string(tagValue), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetRole(domainName DomainName, roleName EntityName, auditLog *bool, expand *bool, pending *bool) (*Role, error) {
	var data *Role
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + encodeParams(encodeOptionalBoolParam("auditLog", auditLog), encodeOptionalBoolParam("expand", expand), encodeOptionalBoolParam("pending", pending))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutRole(domainName DomainName, roleName EntityName, auditRef string, returnObj *bool, resourceOwner string, role *Role) (*Role, error) {
	var data *Role
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName)
	contentBytes, err := json.Marshal(role)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteRole(domainName DomainName, roleName EntityName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetMembership(domainName DomainName, roleName EntityName, memberName MemberName, expiration string) (*Membership, error) {
	var data *Membership
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/member/" + fmt.Sprint(memberName) + encodeParams(encodeStringParam("expiration", string(expiration), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetOverdueReview(domainName DomainName) (*DomainRoleMembers, error) {
	var data *DomainRoleMembers
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/overdue"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetDomainRoleMembers(domainName DomainName) (*DomainRoleMembers, error) {
	var data *DomainRoleMembers
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/member"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPrincipalRoles(principal ResourceName, domainName DomainName, expand *bool) (*DomainRoleMember, error) {
	var data *DomainRoleMember
	url := client.URL + "/role" + encodeParams(encodeStringParam("principal", string(principal), ""), encodeStringParam("domain", string(domainName), ""), encodeOptionalBoolParam("expand", expand))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutMembership(domainName DomainName, roleName EntityName, memberName MemberName, auditRef string, returnObj *bool, resourceOwner string, membership *Membership) (*Membership, error) {
	var data *Membership
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/member/" + fmt.Sprint(memberName)
	contentBytes, err := json.Marshal(membership)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteMembership(domainName DomainName, roleName EntityName, memberName MemberName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/member/" + fmt.Sprint(memberName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeletePendingMembership(domainName DomainName, roleName EntityName, memberName MemberName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/pendingmember/" + fmt.Sprint(memberName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutDefaultAdmins(domainName DomainName, auditRef string, defaultAdmins *DefaultAdmins) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/admins"
	contentBytes, err := json.Marshal(defaultAdmins)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutRoleSystemMeta(domainName DomainName, roleName EntityName, attribute SimpleName, auditRef string, detail *RoleSystemMeta) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/meta/system/" + fmt.Sprint(attribute)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutRoleMeta(domainName DomainName, roleName EntityName, auditRef string, resourceOwner string, detail *RoleMeta) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/meta"
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutMembershipDecision(domainName DomainName, roleName EntityName, memberName MemberName, auditRef string, membership *Membership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/member/" + fmt.Sprint(memberName) + "/decision"
	contentBytes, err := json.Marshal(membership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutRoleReview(domainName DomainName, roleName EntityName, auditRef string, returnObj *bool, resourceOwner string, role *Role) (*Role, error) {
	var data *Role
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/review"
	contentBytes, err := json.Marshal(role)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutResourceRoleOwnership(domainName DomainName, roleName EntityName, auditRef string, resourceOwnership *ResourceRoleOwnership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/role/" + fmt.Sprint(roleName) + "/ownership"
	contentBytes, err := json.Marshal(resourceOwnership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetGroups(domainName DomainName, members *bool, tagKey TagKey, tagValue TagCompoundValue) (*Groups, error) {
	var data *Groups
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/groups" + encodeParams(encodeOptionalBoolParam("members", members), encodeStringParam("tagKey", string(tagKey), ""), encodeStringParam("tagValue", string(tagValue), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetGroup(domainName DomainName, groupName EntityName, auditLog *bool, pending *bool) (*Group, error) {
	var data *Group
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + encodeParams(encodeOptionalBoolParam("auditLog", auditLog), encodeOptionalBoolParam("pending", pending))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutGroup(domainName DomainName, groupName EntityName, auditRef string, returnObj *bool, resourceOwner string, group *Group) (*Group, error) {
	var data *Group
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName)
	contentBytes, err := json.Marshal(group)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteGroup(domainName DomainName, groupName EntityName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetGroupMembership(domainName DomainName, groupName EntityName, memberName GroupMemberName, expiration string) (*GroupMembership, error) {
	var data *GroupMembership
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/member/" + fmt.Sprint(memberName) + encodeParams(encodeStringParam("expiration", string(expiration), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPrincipalGroups(principal EntityName, domainName DomainName) (*DomainGroupMember, error) {
	var data *DomainGroupMember
	url := client.URL + "/group" + encodeParams(encodeStringParam("principal", string(principal), ""), encodeStringParam("domain", string(domainName), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutGroupMembership(domainName DomainName, groupName EntityName, memberName GroupMemberName, auditRef string, returnObj *bool, resourceOwner string, membership *GroupMembership) (*GroupMembership, error) {
	var data *GroupMembership
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/member/" + fmt.Sprint(memberName)
	contentBytes, err := json.Marshal(membership)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteGroupMembership(domainName DomainName, groupName EntityName, memberName GroupMemberName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/member/" + fmt.Sprint(memberName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeletePendingGroupMembership(domainName DomainName, groupName EntityName, memberName GroupMemberName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/pendingmember/" + fmt.Sprint(memberName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutGroupSystemMeta(domainName DomainName, groupName EntityName, attribute SimpleName, auditRef string, detail *GroupSystemMeta) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/meta/system/" + fmt.Sprint(attribute)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutGroupMeta(domainName DomainName, groupName EntityName, auditRef string, resourceOwner string, detail *GroupMeta) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/meta"
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutGroupMembershipDecision(domainName DomainName, groupName EntityName, memberName GroupMemberName, auditRef string, membership *GroupMembership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/member/" + fmt.Sprint(memberName) + "/decision"
	contentBytes, err := json.Marshal(membership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutGroupReview(domainName DomainName, groupName EntityName, auditRef string, returnObj *bool, resourceOwner string, group *Group) (*Group, error) {
	var data *Group
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/review"
	contentBytes, err := json.Marshal(group)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPendingDomainGroupMembersList(principal EntityName, domainName string) (*DomainGroupMembership, error) {
	var data *DomainGroupMembership
	url := client.URL + "/pending_group_members" + encodeParams(encodeStringParam("principal", string(principal), ""), encodeStringParam("domain", string(domainName), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutResourceGroupOwnership(domainName DomainName, groupName EntityName, auditRef string, resourceOwnership *ResourceGroupOwnership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/" + fmt.Sprint(groupName) + "/ownership"
	contentBytes, err := json.Marshal(resourceOwnership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetDomainGroupMembers(domainName DomainName) (*DomainGroupMembers, error) {
	var data *DomainGroupMembers
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/group/member"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPolicyList(domainName DomainName, limit *int32, skip string) (*PolicyList, error) {
	var data *PolicyList
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy" + encodeParams(encodeOptionalInt32Param("limit", limit), encodeStringParam("skip", string(skip), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPolicies(domainName DomainName, assertions *bool, includeNonActive *bool, tagKey TagKey, tagValue TagCompoundValue) (*Policies, error) {
	var data *Policies
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policies" + encodeParams(encodeOptionalBoolParam("assertions", assertions), encodeOptionalBoolParam("includeNonActive", includeNonActive), encodeStringParam("tagKey", string(tagKey), ""), encodeStringParam("tagValue", string(tagValue), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPolicy(domainName DomainName, policyName EntityName) (*Policy, error) {
	var data *Policy
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutPolicy(domainName DomainName, policyName EntityName, auditRef string, returnObj *bool, resourceOwner string, policy *Policy) (*Policy, error) {
	var data *Policy
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName)
	contentBytes, err := json.Marshal(policy)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeletePolicy(domainName DomainName, policyName EntityName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetAssertion(domainName DomainName, policyName EntityName, assertionId int64) (*Assertion, error) {
	var data *Assertion
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion/" + fmt.Sprint(assertionId)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutAssertion(domainName DomainName, policyName EntityName, auditRef string, resourceOwner string, assertion *Assertion) (*Assertion, error) {
	var data *Assertion
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion"
	contentBytes, err := json.Marshal(assertion)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutAssertionPolicyVersion(domainName DomainName, policyName EntityName, version SimpleName, auditRef string, resourceOwner string, assertion *Assertion) (*Assertion, error) {
	var data *Assertion
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version/" + fmt.Sprint(version) + "/assertion"
	contentBytes, err := json.Marshal(assertion)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteAssertion(domainName DomainName, policyName EntityName, assertionId int64, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion/" + fmt.Sprint(assertionId)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteAssertionPolicyVersion(domainName DomainName, policyName EntityName, version SimpleName, assertionId int64, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version/" + fmt.Sprint(version) + "/assertion/" + fmt.Sprint(assertionId)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutAssertionConditions(domainName DomainName, policyName EntityName, assertionId int64, auditRef string, resourceOwner string, assertionConditions *AssertionConditions) (*AssertionConditions, error) {
	var data *AssertionConditions
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion/" + fmt.Sprint(assertionId) + "/conditions"
	contentBytes, err := json.Marshal(assertionConditions)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutAssertionCondition(domainName DomainName, policyName EntityName, assertionId int64, auditRef string, resourceOwner string, assertionCondition *AssertionCondition) (*AssertionCondition, error) {
	var data *AssertionCondition
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion/" + fmt.Sprint(assertionId) + "/condition"
	contentBytes, err := json.Marshal(assertionCondition)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteAssertionConditions(domainName DomainName, policyName EntityName, assertionId int64, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion/" + fmt.Sprint(assertionId) + "/conditions"
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteAssertionCondition(domainName DomainName, policyName EntityName, assertionId int64, conditionId int32, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/assertion/" + fmt.Sprint(assertionId) + "/condition/" + fmt.Sprint(conditionId)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetPolicyVersionList(domainName DomainName, policyName EntityName) (*PolicyList, error) {
	var data *PolicyList
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPolicyVersion(domainName DomainName, policyName EntityName, version SimpleName) (*Policy, error) {
	var data *Policy
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version/" + fmt.Sprint(version)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutPolicyVersion(domainName DomainName, policyName EntityName, policyOptions *PolicyOptions, auditRef string, returnObj *bool, resourceOwner string) (*Policy, error) {
	var data *Policy
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version/create"
	contentBytes, err := json.Marshal(policyOptions)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) SetActivePolicyVersion(domainName DomainName, policyName EntityName, policyOptions *PolicyOptions, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version/active"
	contentBytes, err := json.Marshal(policyOptions)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeletePolicyVersion(domainName DomainName, policyName EntityName, version SimpleName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/version/" + fmt.Sprint(version)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutResourcePolicyOwnership(domainName DomainName, policyName EntityName, auditRef string, resourceOwnership *ResourcePolicyOwnership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/policy/" + fmt.Sprint(policyName) + "/ownership"
	contentBytes, err := json.Marshal(resourceOwnership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutServiceIdentity(domain DomainName, service SimpleName, auditRef string, returnObj *bool, resourceOwner string, detail *ServiceIdentity) (*ServiceIdentity, error) {
	var data *ServiceIdentity
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Athenz-Return-Object":  strconv.FormatBool(*returnObj),
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204, 200:
		if 204 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return data, err
			}
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetServiceIdentity(domain DomainName, service SimpleName) (*ServiceIdentity, error) {
	var data *ServiceIdentity
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteServiceIdentity(domain DomainName, service SimpleName, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetServiceIdentities(domainName DomainName, publickeys *bool, hosts *bool, tagKey TagKey, tagValue TagCompoundValue) (*ServiceIdentities, error) {
	var data *ServiceIdentities
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/services" + encodeParams(encodeOptionalBoolParam("publickeys", publickeys), encodeOptionalBoolParam("hosts", hosts), encodeStringParam("tagKey", string(tagKey), ""), encodeStringParam("tagValue", string(tagValue), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetServiceIdentityList(domainName DomainName, limit *int32, skip string) (*ServiceIdentityList, error) {
	var data *ServiceIdentityList
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/service" + encodeParams(encodeOptionalInt32Param("limit", limit), encodeStringParam("skip", string(skip), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPublicKeyEntry(domain DomainName, service SimpleName, id string) (*PublicKeyEntry, error) {
	var data *PublicKeyEntry
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/publickey/" + id
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutPublicKeyEntry(domain DomainName, service SimpleName, id string, auditRef string, resourceOwner string, publicKeyEntry *PublicKeyEntry) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/publickey/" + id
	contentBytes, err := json.Marshal(publicKeyEntry)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeletePublicKeyEntry(domain DomainName, service SimpleName, id string, auditRef string, resourceOwner string) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/publickey/" + id
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutServiceIdentitySystemMeta(domain DomainName, service SimpleName, attribute SimpleName, auditRef string, detail *ServiceIdentitySystemMeta) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/meta/system/" + fmt.Sprint(attribute)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutResourceServiceIdentityOwnership(domainName DomainName, service SimpleName, auditRef string, resourceOwnership *ResourceServiceIdentityOwnership) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/service/" + fmt.Sprint(service) + "/ownership"
	contentBytes, err := json.Marshal(resourceOwnership)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) SearchServiceIdentities(serviceName SimpleName, substringMatch *bool, domainFilter DomainName) (*ServiceIdentities, error) {
	var data *ServiceIdentities
	url := client.URL + "/service/" + fmt.Sprint(serviceName) + encodeParams(encodeOptionalBoolParam("substringMatch", substringMatch), encodeStringParam("domainFilter", string(domainFilter), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutServiceCredsEntry(domain DomainName, service SimpleName, auditRef string, resourceOwner string, credEntry *CredsEntry) error {
	headers := map[string]string{
		"Athenz-Resource-Owner": resourceOwner,
		"Y-Audit-Ref":           auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/creds"
	contentBytes, err := json.Marshal(credEntry)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutTenancy(domain DomainName, service ServiceName, auditRef string, detail *Tenancy) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/tenancy/" + fmt.Sprint(service)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteTenancy(domain DomainName, service ServiceName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/tenancy/" + fmt.Sprint(service)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutTenant(domain DomainName, service SimpleName, tenantDomain DomainName, auditRef string, detail *Tenancy) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/tenant/" + fmt.Sprint(tenantDomain)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteTenant(domain DomainName, service SimpleName, tenantDomain DomainName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/tenant/" + fmt.Sprint(tenantDomain)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutTenantResourceGroupRoles(domain DomainName, service SimpleName, tenantDomain DomainName, resourceGroup EntityName, auditRef string, detail *TenantResourceGroupRoles) (*TenantResourceGroupRoles, error) {
	var data *TenantResourceGroupRoles
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/tenant/" + fmt.Sprint(tenantDomain) + "/resourceGroup/" + fmt.Sprint(resourceGroup)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetTenantResourceGroupRoles(domain DomainName, service SimpleName, tenantDomain DomainName, resourceGroup EntityName) (*TenantResourceGroupRoles, error) {
	var data *TenantResourceGroupRoles
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/tenant/" + fmt.Sprint(tenantDomain) + "/resourceGroup/" + fmt.Sprint(resourceGroup)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteTenantResourceGroupRoles(domain DomainName, service SimpleName, tenantDomain DomainName, resourceGroup EntityName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domain) + "/service/" + fmt.Sprint(service) + "/tenant/" + fmt.Sprint(tenantDomain) + "/resourceGroup/" + fmt.Sprint(resourceGroup)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) PutProviderResourceGroupRoles(tenantDomain DomainName, provDomain DomainName, provService SimpleName, resourceGroup EntityName, auditRef string, detail *ProviderResourceGroupRoles) (*ProviderResourceGroupRoles, error) {
	var data *ProviderResourceGroupRoles
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(tenantDomain) + "/provDomain/" + fmt.Sprint(provDomain) + "/provService/" + fmt.Sprint(provService) + "/resourceGroup/" + fmt.Sprint(resourceGroup)
	contentBytes, err := json.Marshal(detail)
	if err != nil {
		return data, err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetProviderResourceGroupRoles(tenantDomain DomainName, provDomain DomainName, provService SimpleName, resourceGroup EntityName) (*ProviderResourceGroupRoles, error) {
	var data *ProviderResourceGroupRoles
	url := client.URL + "/domain/" + fmt.Sprint(tenantDomain) + "/provDomain/" + fmt.Sprint(provDomain) + "/provService/" + fmt.Sprint(provService) + "/resourceGroup/" + fmt.Sprint(resourceGroup)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteProviderResourceGroupRoles(tenantDomain DomainName, provDomain DomainName, provService SimpleName, resourceGroup EntityName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(tenantDomain) + "/provDomain/" + fmt.Sprint(provDomain) + "/provService/" + fmt.Sprint(provService) + "/resourceGroup/" + fmt.Sprint(resourceGroup)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetAccess(action ActionName, resource ResourceName, domain DomainName, checkPrincipal EntityName) (*Access, error) {
	var data *Access
	url := client.URL + "/access/" + fmt.Sprint(action) + "/" + fmt.Sprint(resource) + encodeParams(encodeStringParam("domain", string(domain), ""), encodeStringParam("principal", string(checkPrincipal), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetAccessExt(action ActionName, resource string, domain DomainName, checkPrincipal EntityName) (*Access, error) {
	var data *Access
	url := client.URL + "/access/" + fmt.Sprint(action) + encodeParams(encodeStringParam("resource", string(resource), ""), encodeStringParam("domain", string(domain), ""), encodeStringParam("principal", string(checkPrincipal), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetResourceAccessList(principal ResourceName, action ActionName, filter string) (*ResourceAccessList, error) {
	var data *ResourceAccessList
	url := client.URL + "/resource" + encodeParams(encodeStringParam("principal", string(principal), ""), encodeStringParam("action", string(action), ""), encodeStringParam("filter", string(filter), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetSignedDomains(domain DomainName, metaOnly string, metaAttr SimpleName, master *bool, conditions *bool, matchingTag string) (*SignedDomains, string, error) {
	var data *SignedDomains
	headers := map[string]string{
		"If-None-Match": matchingTag,
	}
	url := client.URL + "/sys/modified_domains" + encodeParams(encodeStringParam("domain", string(domain), ""), encodeStringParam("metaonly", string(metaOnly), ""), encodeStringParam("metaattr", string(metaAttr), ""), encodeOptionalBoolParam("master", master), encodeOptionalBoolParam("conditions", conditions))
	resp, err := client.httpGet(url, headers)
	if err != nil {
		return nil, "", err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200, 304:
		if 304 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return nil, "", err
			}
		}
		tag := resp.Header.Get(rdl.FoldHttpHeaderName("ETag"))
		return data, tag, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return nil, "", err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return nil, "", errobj
	}
}

func (client ZMSClient) GetJWSDomain(name DomainName, signatureP1363Format *bool, matchingTag string) (*JWSDomain, string, error) {
	var data *JWSDomain
	headers := map[string]string{
		"If-None-Match": matchingTag,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/signed" + encodeParams(encodeOptionalBoolParam("signaturep1363format", signatureP1363Format))
	resp, err := client.httpGet(url, headers)
	if err != nil {
		return nil, "", err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200, 304:
		if 304 != resp.StatusCode {
			err = json.NewDecoder(resp.Body).Decode(&data)
			if err != nil {
				return nil, "", err
			}
		}
		tag := resp.Header.Get(rdl.FoldHttpHeaderName("ETag"))
		return data, tag, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return nil, "", err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return nil, "", errobj
	}
}

func (client ZMSClient) GetUserToken(userName SimpleName, serviceNames string, header *bool) (*UserToken, error) {
	var data *UserToken
	url := client.URL + "/user/" + fmt.Sprint(userName) + "/token" + encodeParams(encodeStringParam("services", string(serviceNames), ""), encodeOptionalBoolParam("header", header))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) OptionsUserToken(userName SimpleName, serviceNames string) (*UserToken, error) {
	var data *UserToken
	url := client.URL + "/user/" + fmt.Sprint(userName) + "/token" + encodeParams(encodeStringParam("services", string(serviceNames), ""))
	resp, err := client.httpOptions(url, nil, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetServicePrincipal() (*ServicePrincipal, error) {
	var data *ServicePrincipal
	url := client.URL + "/principal"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetServerTemplateList() (*ServerTemplateList, error) {
	var data *ServerTemplateList
	url := client.URL + "/template"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetTemplate(template SimpleName) (*Template, error) {
	var data *Template
	url := client.URL + "/template/" + fmt.Sprint(template)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetDomainTemplateDetailsList(name DomainName) (*DomainTemplateDetailsList, error) {
	var data *DomainTemplateDetailsList
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/templatedetails"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetServerTemplateDetailsList() (*DomainTemplateDetailsList, error) {
	var data *DomainTemplateDetailsList
	url := client.URL + "/templatedetails"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetUserList(domainName DomainName) (*UserList, error) {
	var data *UserList
	url := client.URL + "/user" + encodeParams(encodeStringParam("domain", string(domainName), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) DeleteUser(name SimpleName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/user/" + fmt.Sprint(name)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteDomainRoleMember(domainName DomainName, memberName MemberName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(domainName) + "/member/" + fmt.Sprint(memberName)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetQuota(name DomainName) (*Quota, error) {
	var data *Quota
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/quota"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutQuota(name DomainName, auditRef string, quota *Quota) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/quota"
	contentBytes, err := json.Marshal(quota)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteQuota(name DomainName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/quota"
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetStatus() (*Status, error) {
	var data *Status
	url := client.URL + "/status"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetPendingDomainRoleMembersList(principal EntityName, domainName string) (*DomainRoleMembership, error) {
	var data *DomainRoleMembership
	url := client.URL + "/pending_members" + encodeParams(encodeStringParam("principal", string(principal), ""), encodeStringParam("domain", string(domainName), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetUserAuthorityAttributeMap() (*UserAuthorityAttributeMap, error) {
	var data *UserAuthorityAttributeMap
	url := client.URL + "/authority/user/attribute"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetStats(name DomainName) (*Stats, error) {
	var data *Stats
	url := client.URL + "/domain/" + fmt.Sprint(name) + "/stats"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetSystemStats() (*Stats, error) {
	var data *Stats
	url := client.URL + "/sys/stats"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutDomainDependency(domainName DomainName, auditRef string, service *DependentService) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/dependency/domain/" + fmt.Sprint(domainName)
	contentBytes, err := json.Marshal(service)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) DeleteDomainDependency(domainName DomainName, service ServiceName, auditRef string) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/dependency/domain/" + fmt.Sprint(domainName) + "/service/" + fmt.Sprint(service)
	resp, err := client.httpDelete(url, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetDependentServiceList(domainName DomainName) (*ServiceIdentityList, error) {
	var data *ServiceIdentityList
	url := client.URL + "/dependency/domain/" + fmt.Sprint(domainName)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetDependentServiceResourceGroupList(domainName DomainName) (*DependentServiceResourceGroupList, error) {
	var data *DependentServiceResourceGroupList
	url := client.URL + "/dependency/domain/" + fmt.Sprint(domainName) + "/resourceGroup"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetDependentDomainList(service ServiceName) (*DomainList, error) {
	var data *DomainList
	url := client.URL + "/dependency/service/" + fmt.Sprint(service)
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetRolesForReview(principal ResourceName) (*ReviewObjects, error) {
	var data *ReviewObjects
	url := client.URL + "/review/role" + encodeParams(encodeStringParam("principal", string(principal), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetGroupsForReview(principal ResourceName) (*ReviewObjects, error) {
	var data *ReviewObjects
	url := client.URL + "/review/group" + encodeParams(encodeStringParam("principal", string(principal), ""))
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) GetInfo() (*Info, error) {
	var data *Info
	url := client.URL + "/sys/info"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}

func (client ZMSClient) PutPrincipalState(principalName MemberName, auditRef string, principalState *PrincipalState) error {
	headers := map[string]string{
		"Y-Audit-Ref": auditRef,
	}
	url := client.URL + "/principal/" + fmt.Sprint(principalName) + "/state"
	contentBytes, err := json.Marshal(principalState)
	if err != nil {
		return err
	}
	resp, err := client.httpPut(url, headers, contentBytes)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 204:
		return nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err = io.ReadAll(resp.Body)
		if err != nil {
			return err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return errobj
	}
}

func (client ZMSClient) GetRdlSchema() (*rdl.Schema, error) {
	var data *rdl.Schema
	url := client.URL + "/schema"
	resp, err := client.httpGet(url, nil)
	if err != nil {
		return data, err
	}
	defer resp.Body.Close()
	switch resp.StatusCode {
	case 200:
		err = json.NewDecoder(resp.Body).Decode(&data)
		if err != nil {
			return data, err
		}
		return data, nil
	default:
		var errobj rdl.ResourceError
		contentBytes, err := io.ReadAll(resp.Body)
		if err != nil {
			return data, err
		}
		json.Unmarshal(contentBytes, &errobj)
		if errobj.Code == 0 {
			errobj.Code = resp.StatusCode
		}
		if errobj.Message == "" {
			errobj.Message = string(contentBytes)
		}
		return data, errobj
	}
}
