// GetQuotaAsRequest returns a quota as a request
GetQuotaAsRequest returns a quota as a request
// GetQuotaAsRequest returns a quota as a request
func (q *Quota) GetQuotaAsRequest() CreateQuotaPayload {
	var user, clientID string
	if q.EntityType == QuotaEntityUser || q.EntityType == QuotaEntityUsersDefault {
		user = q.EntityName
	}
	if q.EntityType == QuotaEntityUserClient {
		user = q.EntityName
		clientID = q.Child
	}
	if q.EntityType == QuotaEntityUsers {
		user = "*"
	}
	if q.EntityType == QuotaEntityClient || q.EntityType == QuotaEntityClients {
		clientID = q.EntityName
	}
	if q.EntityType == QuotaEntityClientsDefault {
		clientID = "*"
	}
	return CreateQuotaPayload{
		QuotaType: string(q.EntityType),
		User:      user,
		ClientID:  clientID,
		Config: QuotaConfig{
			ProducerByteRate:  q.Properties.ProducerByteRate,
			ConsumerByteRate:  q.Properties.ConsumerByteRate,
			RequestPercentage: q.Properties.RequestPercentage,
		},
	}
}
func ( q * Quota ) GetQuotaAsRequest ( ) CreateQuotaPayload { var user , clientID string if q . EntityType == QuotaEntityUser || q . EntityType == QuotaEntityUsersDefault { user = q . EntityName } if q . EntityType == QuotaEntityUserClient { user = q . EntityName clientID = q . Child } if q . EntityType == QuotaEntityUsers { user = " " } if q . EntityType == QuotaEntityClient || q . EntityType == QuotaEntityClients { clientID = q . EntityName } if q . EntityType == QuotaEntityClientsDefault { clientID = " " } return CreateQuotaPayload { QuotaType : string ( q . EntityType ) , User : user , ClientID : clientID , Config : QuotaConfig { ProducerByteRate : q . Properties . ProducerByteRate , ConsumerByteRate : q . Properties . ConsumerByteRate , RequestPercentage : q . Properties . RequestPercentage , } , } }
GetQuotaAsRequest returns a quota as a request
GetQuotaAsRequest returns a quota as a request
// per user // user client pair