Documentation

Overview

Package licensing provides access to the Enterprise License Manager API.

For product documentation, see: https://developers.google.com/admin-sdk/licensing/

Creating a client

Usage example:

import "google.golang.org/api/licensing/v1"
...
ctx := context.Background()
licensingService, err := licensing.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

licensingService, err := licensing.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
licensingService, err := licensing.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (
	// View and manage G Suite licenses for your domain
	AppsLicensingScope = "https://www.googleapis.com/auth/apps.licensing"
)

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`
}

Empty: A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.

type LicenseAssignment

type LicenseAssignment struct {
	// Etags: ETag of the resource.
	Etags string `json:"etags,omitempty"`

	// Kind: Identifies the resource as a LicenseAssignment, which is
	// `licensing#licenseAssignment`.
	Kind string `json:"kind,omitempty"`

	// ProductId: A product's unique identifier. For more information about
	// products in this version of the API, see Product and SKU IDs.
	ProductId string `json:"productId,omitempty"`

	// ProductName: Display Name of the product.
	ProductName string `json:"productName,omitempty"`

	// SelfLink: Link to this page.
	SelfLink string `json:"selfLink,omitempty"`

	// SkuId: A product SKU's unique identifier. For more information about
	// available SKUs in this version of the API, see Products and SKUs.
	SkuId string `json:"skuId,omitempty"`

	// SkuName: Display Name of the sku of the product.
	SkuName string `json:"skuName,omitempty"`

	// UserId: The user's current primary email address. If the user's email
	// address changes, use the new email address in your API requests.
	// Since a `userId` is subject to change, do not use a `userId` value as
	// a key for persistent data. This key could break if the current user's
	// email address changes. If the `userId` is suspended, the license
	// status changes.
	UserId string `json:"userId,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Etags") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Etags") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

LicenseAssignment: Representation of a license assignment.

func (*LicenseAssignment) MarshalJSON

func (s *LicenseAssignment) MarshalJSON() ([]byte, error)

type LicenseAssignmentInsert

type LicenseAssignmentInsert struct {
	// UserId: Email id of the user
	UserId string `json:"userId,omitempty"`

	// ForceSendFields is a list of field names (e.g. "UserId") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "UserId") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

LicenseAssignmentInsert: Representation of a license assignment.

func (*LicenseAssignmentInsert) MarshalJSON

func (s *LicenseAssignmentInsert) MarshalJSON() ([]byte, error)

type LicenseAssignmentList

type LicenseAssignmentList struct {
	// Etag: ETag of the resource.
	Etag string `json:"etag,omitempty"`

	// Items: The LicenseAssignments in this page of results.
	Items []*LicenseAssignment `json:"items,omitempty"`

	// Kind: Identifies the resource as a collection of LicenseAssignments.
	Kind string `json:"kind,omitempty"`

	// NextPageToken: The token that you must submit in a subsequent request
	// to retrieve additional license results matching your query
	// parameters. The `maxResults` query string is related to the
	// `nextPageToken` since `maxResults` determines how many entries are
	// returned on each next page.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Etag") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Etag") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

func (*LicenseAssignmentList) MarshalJSON

func (s *LicenseAssignmentList) MarshalJSON() ([]byte, error)

type LicenseAssignmentsDeleteCall

type LicenseAssignmentsDeleteCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsDeleteCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsDeleteCall) Do

Do executes the "licensing.licenseAssignments.delete" call. Exactly one of *Empty or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *Empty.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsDeleteCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsDeleteCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type LicenseAssignmentsGetCall

type LicenseAssignmentsGetCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsGetCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsGetCall) Do

Do executes the "licensing.licenseAssignments.get" call. Exactly one of *LicenseAssignment or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LicenseAssignment.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsGetCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsGetCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*LicenseAssignmentsGetCall) IfNoneMatch

func (c *LicenseAssignmentsGetCall) IfNoneMatch(entityTag string) *LicenseAssignmentsGetCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

type LicenseAssignmentsInsertCall

type LicenseAssignmentsInsertCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsInsertCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsInsertCall) Do

Do executes the "licensing.licenseAssignments.insert" call. Exactly one of *LicenseAssignment or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LicenseAssignment.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsInsertCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsInsertCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type LicenseAssignmentsListForProductAndSkuCall

type LicenseAssignmentsListForProductAndSkuCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsListForProductAndSkuCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsListForProductAndSkuCall) Do

Do executes the "licensing.licenseAssignments.listForProductAndSku" call. Exactly one of *LicenseAssignmentList or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LicenseAssignmentList.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsListForProductAndSkuCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsListForProductAndSkuCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*LicenseAssignmentsListForProductAndSkuCall) IfNoneMatch

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*LicenseAssignmentsListForProductAndSkuCall) MaxResults

MaxResults sets the optional parameter "maxResults": The `maxResults` query string determines how many entries are returned on each page of a large response. This is an optional parameter. The value must be a positive number.

func (*LicenseAssignmentsListForProductAndSkuCall) PageToken

PageToken sets the optional parameter "pageToken": Token to fetch the next page of data. The `maxResults` query string is related to the `pageToken` since `maxResults` determines how many entries are returned on each page. This is an optional query string. If not specified, the server returns the first page.

func (*LicenseAssignmentsListForProductAndSkuCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type LicenseAssignmentsListForProductCall

type LicenseAssignmentsListForProductCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsListForProductCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsListForProductCall) Do

Do executes the "licensing.licenseAssignments.listForProduct" call. Exactly one of *LicenseAssignmentList or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LicenseAssignmentList.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsListForProductCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsListForProductCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*LicenseAssignmentsListForProductCall) IfNoneMatch

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*LicenseAssignmentsListForProductCall) MaxResults

MaxResults sets the optional parameter "maxResults": The `maxResults` query string determines how many entries are returned on each page of a large response. This is an optional parameter. The value must be a positive number.

func (*LicenseAssignmentsListForProductCall) PageToken

PageToken sets the optional parameter "pageToken": Token to fetch the next page of data. The `maxResults` query string is related to the `pageToken` since `maxResults` determines how many entries are returned on each page. This is an optional query string. If not specified, the server returns the first page.

func (*LicenseAssignmentsListForProductCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type LicenseAssignmentsPatchCall

type LicenseAssignmentsPatchCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsPatchCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsPatchCall) Do

Do executes the "licensing.licenseAssignments.patch" call. Exactly one of *LicenseAssignment or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LicenseAssignment.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsPatchCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsPatchCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type LicenseAssignmentsService

type LicenseAssignmentsService struct {
	// contains filtered or unexported fields
}

func NewLicenseAssignmentsService

func NewLicenseAssignmentsService(s *Service) *LicenseAssignmentsService

func (*LicenseAssignmentsService) Delete

func (r *LicenseAssignmentsService) Delete(productId string, skuId string, userId string) *LicenseAssignmentsDeleteCall

Delete: Revoke a license.

func (*LicenseAssignmentsService) Get

func (r *LicenseAssignmentsService) Get(productId string, skuId string, userId string) *LicenseAssignmentsGetCall

Get: Get a specific user's license by product SKU.

func (*LicenseAssignmentsService) Insert

func (r *LicenseAssignmentsService) Insert(productId string, skuId string, licenseassignmentinsert *LicenseAssignmentInsert) *LicenseAssignmentsInsertCall

Insert: Assign a license.

func (*LicenseAssignmentsService) ListForProduct

func (r *LicenseAssignmentsService) ListForProduct(productId string, customerId string) *LicenseAssignmentsListForProductCall

ListForProduct: List all users assigned licenses for a specific product SKU.

func (*LicenseAssignmentsService) ListForProductAndSku

func (r *LicenseAssignmentsService) ListForProductAndSku(productId string, skuId string, customerId string) *LicenseAssignmentsListForProductAndSkuCall

ListForProductAndSku: List all users assigned licenses for a specific product SKU.

func (*LicenseAssignmentsService) Patch

func (r *LicenseAssignmentsService) Patch(productId string, skuId string, userId string, licenseassignment *LicenseAssignment) *LicenseAssignmentsPatchCall

Patch: Reassign a user's product SKU with a different SKU in the same product. This method supports patch semantics.

func (*LicenseAssignmentsService) Update

func (r *LicenseAssignmentsService) Update(productId string, skuId string, userId string, licenseassignment *LicenseAssignment) *LicenseAssignmentsUpdateCall

Update: Reassign a user's product SKU with a different SKU in the same product.

type LicenseAssignmentsUpdateCall

type LicenseAssignmentsUpdateCall struct {
	// contains filtered or unexported fields
}

func (*LicenseAssignmentsUpdateCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*LicenseAssignmentsUpdateCall) Do

Do executes the "licensing.licenseAssignments.update" call. Exactly one of *LicenseAssignment or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LicenseAssignment.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*LicenseAssignmentsUpdateCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*LicenseAssignmentsUpdateCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	LicenseAssignments *LicenseAssignmentsService
	// contains filtered or unexported fields
}

func New

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

Source Files