Documentation

Overview

Package oslogin provides access to the Cloud OS Login API.

This package is DEPRECATED. Use package cloud.google.com/go/oslogin/apiv1 instead.

For product documentation, see: https://cloud.google.com/compute/docs/oslogin/

Creating a client

Usage example:

import "google.golang.org/api/oslogin/v1beta"
...
ctx := context.Background()
osloginService, err := oslogin.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

By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:

osloginService, err := oslogin.NewService(ctx, option.WithScopes(oslogin.ComputeReadonlyScope))

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

osloginService, err := oslogin.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, ...)
osloginService, err := oslogin.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 (
	// See, edit, configure, and delete your Google Cloud Platform data
	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"

	// View your data across Google Cloud Platform services
	CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only"

	// View and manage your Google Compute Engine resources
	ComputeScope = "https://www.googleapis.com/auth/compute"

	// View your Google Compute Engine resources
	ComputeReadonlyScope = "https://www.googleapis.com/auth/compute.readonly"
)

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 ImportSshPublicKeyResponse

type ImportSshPublicKeyResponse struct {
	// Details: Detailed information about import results.
	Details string `json:"details,omitempty"`

	// LoginProfile: The login profile information for the user.
	LoginProfile *LoginProfile `json:"loginProfile,omitempty"`

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

	// ForceSendFields is a list of field names (e.g. "Details") 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. "Details") 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:"-"`
}

ImportSshPublicKeyResponse: A response message for importing an SSH public key.

func (*ImportSshPublicKeyResponse) MarshalJSON

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

type LoginProfile

type LoginProfile struct {
	// Name: Required. A unique user ID.
	Name string `json:"name,omitempty"`

	// PosixAccounts: The list of POSIX accounts associated with the user.
	PosixAccounts []*PosixAccount `json:"posixAccounts,omitempty"`

	// SshPublicKeys: A map from SSH public key fingerprint to the
	// associated key object.
	SshPublicKeys map[string]SshPublicKey `json:"sshPublicKeys,omitempty"`

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

	// ForceSendFields is a list of field names (e.g. "Name") 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. "Name") 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:"-"`
}

LoginProfile: The user profile information used for logging in to a virtual machine on Google Compute Engine.

func (*LoginProfile) MarshalJSON

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

type PosixAccount

type PosixAccount struct {
	// AccountId: Output only. A POSIX account identifier.
	AccountId string `json:"accountId,omitempty"`

	// Gecos: The GECOS (user information) entry for this account.
	Gecos string `json:"gecos,omitempty"`

	// Gid: The default group ID.
	Gid int64 `json:"gid,omitempty,string"`

	// HomeDirectory: The path to the home directory for this account.
	HomeDirectory string `json:"homeDirectory,omitempty"`

	// Name: Output only. The canonical resource name.
	Name string `json:"name,omitempty"`

	// OperatingSystemType: The operating system type where this account
	// applies.
	//
	// Possible values:
	//   "OPERATING_SYSTEM_TYPE_UNSPECIFIED" - The operating system type
	// associated with the user account information is unspecified.
	//   "LINUX" - Linux user account information.
	//   "WINDOWS" - Windows user account information.
	OperatingSystemType string `json:"operatingSystemType,omitempty"`

	// Primary: Only one POSIX account can be marked as primary.
	Primary bool `json:"primary,omitempty"`

	// Shell: The path to the logic shell for this account.
	Shell string `json:"shell,omitempty"`

	// SystemId: System identifier for which account the username or uid
	// applies to. By default, the empty value is used.
	SystemId string `json:"systemId,omitempty"`

	// Uid: The user ID.
	Uid int64 `json:"uid,omitempty,string"`

	// Username: The username of the POSIX account.
	Username string `json:"username,omitempty"`

	// ForceSendFields is a list of field names (e.g. "AccountId") 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. "AccountId") 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:"-"`
}

PosixAccount: The POSIX account information associated with a Google account.

func (*PosixAccount) MarshalJSON

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

type Service

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

	Users *UsersService
	// 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.

type SshPublicKey

type SshPublicKey struct {
	// ExpirationTimeUsec: An expiration time in microseconds since epoch.
	ExpirationTimeUsec int64 `json:"expirationTimeUsec,omitempty,string"`

	// Fingerprint: Output only. The SHA-256 fingerprint of the SSH public
	// key.
	Fingerprint string `json:"fingerprint,omitempty"`

	// Key: Public key text in SSH format, defined by RFC4253 section 6.6.
	Key string `json:"key,omitempty"`

	// Name: Output only. The canonical resource name.
	Name string `json:"name,omitempty"`

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

	// ForceSendFields is a list of field names (e.g. "ExpirationTimeUsec")
	// 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. "ExpirationTimeUsec") 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:"-"`
}

SshPublicKey: The SSH public key information associated with a Google account.

func (*SshPublicKey) MarshalJSON

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

type UsersGetLoginProfileCall

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

func (*UsersGetLoginProfileCall) 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 (*UsersGetLoginProfileCall) Do

Do executes the "oslogin.users.getLoginProfile" call. Exactly one of *LoginProfile or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *LoginProfile.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 (*UsersGetLoginProfileCall) Fields

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

func (*UsersGetLoginProfileCall) Header

func (c *UsersGetLoginProfileCall) Header() http.Header

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

func (*UsersGetLoginProfileCall) IfNoneMatch

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

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 (*UsersGetLoginProfileCall) ProjectId

func (c *UsersGetLoginProfileCall) ProjectId(projectId string) *UsersGetLoginProfileCall

ProjectId sets the optional parameter "projectId": The project ID of the Google Cloud Platform project.

func (*UsersGetLoginProfileCall) SystemId

SystemId sets the optional parameter "systemId": A system ID for filtering the results of the request.

type UsersImportSshPublicKeyCall

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

func (*UsersImportSshPublicKeyCall) 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 (*UsersImportSshPublicKeyCall) Do

Do executes the "oslogin.users.importSshPublicKey" call. Exactly one of *ImportSshPublicKeyResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *ImportSshPublicKeyResponse.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 (*UsersImportSshPublicKeyCall) Fields

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

func (*UsersImportSshPublicKeyCall) Header

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

func (*UsersImportSshPublicKeyCall) ProjectId

ProjectId sets the optional parameter "projectId": The project ID of the Google Cloud Platform project.

type UsersProjectsDeleteCall

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

func (*UsersProjectsDeleteCall) 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 (*UsersProjectsDeleteCall) Do

Do executes the "oslogin.users.projects.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 (*UsersProjectsDeleteCall) Fields

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

func (*UsersProjectsDeleteCall) Header

func (c *UsersProjectsDeleteCall) Header() http.Header

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

type UsersProjectsService

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

func NewUsersProjectsService

func NewUsersProjectsService(s *Service) *UsersProjectsService

func (*UsersProjectsService) Delete

Delete: Deletes a POSIX account.

- name: A reference to the POSIX account to update. POSIX accounts

are identified by the project ID they are associated with. A
reference to the POSIX account is in format
`users/{user}/projects/{project}`.

type UsersService

type UsersService struct {
	Projects *UsersProjectsService

	SshPublicKeys *UsersSshPublicKeysService
	// contains filtered or unexported fields
}

func NewUsersService

func NewUsersService(s *Service) *UsersService

func (*UsersService) GetLoginProfile

func (r *UsersService) GetLoginProfile(name string) *UsersGetLoginProfileCall

GetLoginProfile: Retrieves the profile information used for logging in to a virtual machine on Google Compute Engine.

- name: The unique ID for the user in format `users/{user}`.

func (*UsersService) ImportSshPublicKey

func (r *UsersService) ImportSshPublicKey(parent string, sshpublickey *SshPublicKey) *UsersImportSshPublicKeyCall

ImportSshPublicKey: Adds an SSH public key and returns the profile information. Default POSIX account information is set when no username and UID exist as part of the login profile.

- parent: The unique ID for the user in format `users/{user}`.

type UsersSshPublicKeysDeleteCall

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

func (*UsersSshPublicKeysDeleteCall) 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 (*UsersSshPublicKeysDeleteCall) Do

Do executes the "oslogin.users.sshPublicKeys.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 (*UsersSshPublicKeysDeleteCall) Fields

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

func (*UsersSshPublicKeysDeleteCall) Header

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

type UsersSshPublicKeysGetCall

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

func (*UsersSshPublicKeysGetCall) 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 (*UsersSshPublicKeysGetCall) Do

Do executes the "oslogin.users.sshPublicKeys.get" call. Exactly one of *SshPublicKey or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *SshPublicKey.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 (*UsersSshPublicKeysGetCall) Fields

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

func (*UsersSshPublicKeysGetCall) Header

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

func (*UsersSshPublicKeysGetCall) IfNoneMatch

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

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 UsersSshPublicKeysPatchCall

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

func (*UsersSshPublicKeysPatchCall) 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 (*UsersSshPublicKeysPatchCall) Do

Do executes the "oslogin.users.sshPublicKeys.patch" call. Exactly one of *SshPublicKey or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *SshPublicKey.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 (*UsersSshPublicKeysPatchCall) Fields

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

func (*UsersSshPublicKeysPatchCall) Header

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

func (*UsersSshPublicKeysPatchCall) UpdateMask

UpdateMask sets the optional parameter "updateMask": Mask to control which fields get updated. Updates all if not present.

type UsersSshPublicKeysService

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

func NewUsersSshPublicKeysService

func NewUsersSshPublicKeysService(s *Service) *UsersSshPublicKeysService

func (*UsersSshPublicKeysService) Delete

Delete: Deletes an SSH public key.

- name: The fingerprint of the public key to update. Public keys are

identified by their SHA-256 fingerprint. The fingerprint of the
public key is in format `users/{user}/sshPublicKeys/{fingerprint}`.

func (*UsersSshPublicKeysService) Get

Get: Retrieves an SSH public key.

- name: The fingerprint of the public key to retrieve. Public keys

are identified by their SHA-256 fingerprint. The fingerprint of the
public key is in format `users/{user}/sshPublicKeys/{fingerprint}`.

func (*UsersSshPublicKeysService) Patch

Patch: Updates an SSH public key and returns the profile information. This method supports patch semantics.

- name: The fingerprint of the public key to update. Public keys are

identified by their SHA-256 fingerprint. The fingerprint of the
public key is in format `users/{user}/sshPublicKeys/{fingerprint}`.

Source Files