osconfig

package
Version: v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package osconfig is an auto-generated package for the OS Config API.

OS management tools that can be used for patch management, patch compliance, and configuration management on VM instances.

Example usage

To get started with this package, create a client.

ctx := context.Background()
c, err := osconfig.NewClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

ctx := context.Background()
c, err := osconfig.NewClient(ctx)
if err != nil {
	// TODO: Handle error.
}
defer c.Close()

req := &osconfigpb.ExecutePatchJobRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ExecutePatchJobRequest.
}
resp, err := c.ExecutePatchJob(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

Types

type CallOptions

type CallOptions struct {
	ExecutePatchJob             []gax.CallOption
	GetPatchJob                 []gax.CallOption
	CancelPatchJob              []gax.CallOption
	ListPatchJobs               []gax.CallOption
	ListPatchJobInstanceDetails []gax.CallOption
	CreatePatchDeployment       []gax.CallOption
	GetPatchDeployment          []gax.CallOption
	ListPatchDeployments        []gax.CallOption
	DeletePatchDeployment       []gax.CallOption
	UpdatePatchDeployment       []gax.CallOption
	PausePatchDeployment        []gax.CallOption
	ResumePatchDeployment       []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

type Client

type Client struct {

	// The call options for this service.
	CallOptions *CallOptions
	// contains filtered or unexported fields
}

Client is a client for interacting with OS Config API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

OS Config API

The OS Config service is a server-side component that you can use to manage package installations and patch jobs for virtual machine instances.

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewClient creates a new os config service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

OS Config API

The OS Config service is a server-side component that you can use to manage package installations and patch jobs for virtual machine instances.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*Client) CancelPatchJob

func (c *Client) CancelPatchJob(ctx context.Context, req *osconfigpb.CancelPatchJobRequest, opts ...gax.CallOption) (*osconfigpb.PatchJob, error)

CancelPatchJob cancel a patch job. The patch job must be active. Canceled patch jobs cannot be restarted.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.CancelPatchJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#CancelPatchJobRequest.
	}
	resp, err := c.CancelPatchJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) Close

func (c *Client) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*Client) Connection

func (c *Client) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*Client) CreatePatchDeployment

CreatePatchDeployment create an OS Config patch deployment.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.CreatePatchDeploymentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#CreatePatchDeploymentRequest.
	}
	resp, err := c.CreatePatchDeployment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) DeletePatchDeployment

func (c *Client) DeletePatchDeployment(ctx context.Context, req *osconfigpb.DeletePatchDeploymentRequest, opts ...gax.CallOption) error

DeletePatchDeployment delete an OS Config patch deployment.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.DeletePatchDeploymentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#DeletePatchDeploymentRequest.
	}
	err = c.DeletePatchDeployment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*Client) ExecutePatchJob

func (c *Client) ExecutePatchJob(ctx context.Context, req *osconfigpb.ExecutePatchJobRequest, opts ...gax.CallOption) (*osconfigpb.PatchJob, error)

ExecutePatchJob patch VM instances by creating and running a patch job.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ExecutePatchJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ExecutePatchJobRequest.
	}
	resp, err := c.ExecutePatchJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) GetPatchDeployment

GetPatchDeployment get an OS Config patch deployment.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.GetPatchDeploymentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetPatchDeploymentRequest.
	}
	resp, err := c.GetPatchDeployment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) GetPatchJob

func (c *Client) GetPatchJob(ctx context.Context, req *osconfigpb.GetPatchJobRequest, opts ...gax.CallOption) (*osconfigpb.PatchJob, error)

GetPatchJob get the patch job. This can be used to track the progress of an ongoing patch job or review the details of completed jobs.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.GetPatchJobRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetPatchJobRequest.
	}
	resp, err := c.GetPatchJob(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) ListPatchDeployments

ListPatchDeployments get a page of OS Config patch deployments.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListPatchDeploymentsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListPatchDeploymentsRequest.
	}
	it := c.ListPatchDeployments(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) ListPatchJobInstanceDetails

ListPatchJobInstanceDetails get a list of instance details for a given patch job.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListPatchJobInstanceDetailsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListPatchJobInstanceDetailsRequest.
	}
	it := c.ListPatchJobInstanceDetails(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) ListPatchJobs

func (c *Client) ListPatchJobs(ctx context.Context, req *osconfigpb.ListPatchJobsRequest, opts ...gax.CallOption) *PatchJobIterator

ListPatchJobs get a list of patch jobs.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListPatchJobsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListPatchJobsRequest.
	}
	it := c.ListPatchJobs(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*Client) PausePatchDeployment added in v1.3.0

PausePatchDeployment change state of patch deployment to “PAUSED”. Patch deployment in paused state doesn’t generate patch jobs.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.PausePatchDeploymentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#PausePatchDeploymentRequest.
	}
	resp, err := c.PausePatchDeployment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) ResumePatchDeployment added in v1.3.0

ResumePatchDeployment change state of patch deployment back to “ACTIVE”. Patch deployment in active state continues to generate patch jobs.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ResumePatchDeploymentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ResumePatchDeploymentRequest.
	}
	resp, err := c.ResumePatchDeployment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) UpdatePatchDeployment added in v1.3.0

UpdatePatchDeployment update an OS Config patch deployment.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.UpdatePatchDeploymentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#UpdatePatchDeploymentRequest.
	}
	resp, err := c.UpdatePatchDeployment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type CreateOSPolicyAssignmentOperation added in v1.2.0

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

CreateOSPolicyAssignmentOperation manages a long-running operation from CreateOSPolicyAssignment.

func (*CreateOSPolicyAssignmentOperation) Done added in v1.2.0

Done reports whether the long-running operation has completed.

func (*CreateOSPolicyAssignmentOperation) Metadata added in v1.2.0

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateOSPolicyAssignmentOperation) Name added in v1.2.0

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateOSPolicyAssignmentOperation) Poll added in v1.2.0

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateOSPolicyAssignmentOperation) Wait added in v1.2.0

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

type DeleteOSPolicyAssignmentOperation added in v1.2.0

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

DeleteOSPolicyAssignmentOperation manages a long-running operation from DeleteOSPolicyAssignment.

func (*DeleteOSPolicyAssignmentOperation) Done added in v1.2.0

Done reports whether the long-running operation has completed.

func (*DeleteOSPolicyAssignmentOperation) Metadata added in v1.2.0

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteOSPolicyAssignmentOperation) Name added in v1.2.0

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteOSPolicyAssignmentOperation) Poll added in v1.2.0

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeleteOSPolicyAssignmentOperation) Wait added in v1.2.0

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

type InventoryIterator added in v0.2.0

type InventoryIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.Inventory, nextPageToken string, err error)
	// contains filtered or unexported fields
}

InventoryIterator manages a stream of *osconfigpb.Inventory.

func (*InventoryIterator) Next added in v0.2.0

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*InventoryIterator) PageInfo added in v0.2.0

func (it *InventoryIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type OSPolicyAssignmentIterator added in v1.2.0

type OSPolicyAssignmentIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.OSPolicyAssignment, nextPageToken string, err error)
	// contains filtered or unexported fields
}

OSPolicyAssignmentIterator manages a stream of *osconfigpb.OSPolicyAssignment.

func (*OSPolicyAssignmentIterator) Next added in v1.2.0

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*OSPolicyAssignmentIterator) PageInfo added in v1.2.0

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type OSPolicyAssignmentReportIterator added in v1.2.0

type OSPolicyAssignmentReportIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.OSPolicyAssignmentReport, nextPageToken string, err error)
	// contains filtered or unexported fields
}

OSPolicyAssignmentReportIterator manages a stream of *osconfigpb.OSPolicyAssignmentReport.

func (*OSPolicyAssignmentReportIterator) Next added in v1.2.0

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*OSPolicyAssignmentReportIterator) PageInfo added in v1.2.0

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type OsConfigZonalCallOptions added in v0.2.0

type OsConfigZonalCallOptions struct {
	CreateOSPolicyAssignment        []gax.CallOption
	UpdateOSPolicyAssignment        []gax.CallOption
	GetOSPolicyAssignment           []gax.CallOption
	ListOSPolicyAssignments         []gax.CallOption
	ListOSPolicyAssignmentRevisions []gax.CallOption
	DeleteOSPolicyAssignment        []gax.CallOption
	GetOSPolicyAssignmentReport     []gax.CallOption
	ListOSPolicyAssignmentReports   []gax.CallOption
	GetInventory                    []gax.CallOption
	ListInventories                 []gax.CallOption
	GetVulnerabilityReport          []gax.CallOption
	ListVulnerabilityReports        []gax.CallOption
}

OsConfigZonalCallOptions contains the retry settings for each method of OsConfigZonalClient.

type OsConfigZonalClient added in v0.2.0

type OsConfigZonalClient struct {

	// The call options for this service.
	CallOptions *OsConfigZonalCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

OsConfigZonalClient is a client for interacting with OS Config API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Zonal OS Config API

The OS Config service is the server-side component that allows users to manage package installations and patch jobs for Compute Engine VM instances.

func NewOsConfigZonalClient added in v0.2.0

func NewOsConfigZonalClient(ctx context.Context, opts ...option.ClientOption) (*OsConfigZonalClient, error)

NewOsConfigZonalClient creates a new os config zonal service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Zonal OS Config API

The OS Config service is the server-side component that allows users to manage package installations and patch jobs for Compute Engine VM instances.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}
Output:

func (*OsConfigZonalClient) Close added in v0.2.0

func (c *OsConfigZonalClient) Close() error

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*OsConfigZonalClient) Connection added in v0.2.0

func (c *OsConfigZonalClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*OsConfigZonalClient) CreateOSPolicyAssignment added in v1.2.0

CreateOSPolicyAssignment create an OS policy assignment.

This method also creates the first revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel (at https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.CreateOSPolicyAssignmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#CreateOSPolicyAssignmentRequest.
	}
	op, err := c.CreateOSPolicyAssignment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*OsConfigZonalClient) CreateOSPolicyAssignmentOperation added in v1.2.0

func (c *OsConfigZonalClient) CreateOSPolicyAssignmentOperation(name string) *CreateOSPolicyAssignmentOperation

CreateOSPolicyAssignmentOperation returns a new CreateOSPolicyAssignmentOperation from a given name. The name must be that of a previously created CreateOSPolicyAssignmentOperation, possibly from a different process.

func (*OsConfigZonalClient) DeleteOSPolicyAssignment added in v1.2.0

DeleteOSPolicyAssignment delete the OS policy assignment.

This method creates a new revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

If the LRO completes and is not cancelled, all revisions associated with the OS policy assignment are deleted.

For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel (at https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.DeleteOSPolicyAssignmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#DeleteOSPolicyAssignmentRequest.
	}
	op, err := c.DeleteOSPolicyAssignment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*OsConfigZonalClient) DeleteOSPolicyAssignmentOperation added in v1.2.0

func (c *OsConfigZonalClient) DeleteOSPolicyAssignmentOperation(name string) *DeleteOSPolicyAssignmentOperation

DeleteOSPolicyAssignmentOperation returns a new DeleteOSPolicyAssignmentOperation from a given name. The name must be that of a previously created DeleteOSPolicyAssignmentOperation, possibly from a different process.

func (*OsConfigZonalClient) GetInventory added in v0.2.0

GetInventory get inventory data for the specified VM instance. If the VM has no associated inventory, the message NOT_FOUND is returned.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.GetInventoryRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetInventoryRequest.
	}
	resp, err := c.GetInventory(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*OsConfigZonalClient) GetOSPolicyAssignment added in v1.2.0

GetOSPolicyAssignment retrieve an existing OS policy assignment.

This method always returns the latest revision. In order to retrieve a previous revision of the assignment, also provide the revision ID in the name parameter.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.GetOSPolicyAssignmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetOSPolicyAssignmentRequest.
	}
	resp, err := c.GetOSPolicyAssignment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*OsConfigZonalClient) GetOSPolicyAssignmentReport added in v1.2.0

GetOSPolicyAssignmentReport get the OS policy asssignment report for the specified Compute Engine VM instance.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.GetOSPolicyAssignmentReportRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetOSPolicyAssignmentReportRequest.
	}
	resp, err := c.GetOSPolicyAssignmentReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*OsConfigZonalClient) GetVulnerabilityReport added in v0.2.0

GetVulnerabilityReport gets the vulnerability report for the specified VM instance. Only VMs with inventory data have vulnerability reports associated with them.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.GetVulnerabilityReportRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#GetVulnerabilityReportRequest.
	}
	resp, err := c.GetVulnerabilityReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*OsConfigZonalClient) ListInventories added in v0.2.0

ListInventories list inventory data for all VM instances in the specified zone.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListInventoriesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListInventoriesRequest.
	}
	it := c.ListInventories(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*OsConfigZonalClient) ListOSPolicyAssignmentReports added in v1.2.0

ListOSPolicyAssignmentReports list OS policy asssignment reports for all Compute Engine VM instances in the specified zone.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListOSPolicyAssignmentReportsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentReportsRequest.
	}
	it := c.ListOSPolicyAssignmentReports(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*OsConfigZonalClient) ListOSPolicyAssignmentRevisions added in v1.2.0

ListOSPolicyAssignmentRevisions list the OS policy assignment revisions for a given OS policy assignment.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListOSPolicyAssignmentRevisionsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentRevisionsRequest.
	}
	it := c.ListOSPolicyAssignmentRevisions(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*OsConfigZonalClient) ListOSPolicyAssignments added in v1.2.0

ListOSPolicyAssignments list the OS policy assignments under the parent resource.

For each OS policy assignment, the latest revision is returned.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListOSPolicyAssignmentsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListOSPolicyAssignmentsRequest.
	}
	it := c.ListOSPolicyAssignments(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*OsConfigZonalClient) ListVulnerabilityReports added in v0.2.0

ListVulnerabilityReports list vulnerability reports for all VM instances in the specified zone.

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	"google.golang.org/api/iterator"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.ListVulnerabilityReportsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#ListVulnerabilityReportsRequest.
	}
	it := c.ListVulnerabilityReports(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*OsConfigZonalClient) UpdateOSPolicyAssignment added in v1.2.0

UpdateOSPolicyAssignment update an existing OS policy assignment.

This method creates a new revision of the OS policy assignment.

This method returns a long running operation (LRO) that contains the rollout details. The rollout can be cancelled by cancelling the LRO.

For more information, see Method: projects.locations.osPolicyAssignments.operations.cancel (at https://cloud.google.com/compute/docs/osconfig/rest/v1/projects.locations.osPolicyAssignments.operations/cancel).

Example
package main

import (
	"context"

	osconfig "cloud.google.com/go/osconfig/apiv1"
	osconfigpb "google.golang.org/genproto/googleapis/cloud/osconfig/v1"
)

func main() {
	ctx := context.Background()
	c, err := osconfig.NewOsConfigZonalClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &osconfigpb.UpdateOSPolicyAssignmentRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/osconfig/v1#UpdateOSPolicyAssignmentRequest.
	}
	op, err := c.UpdateOSPolicyAssignment(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*OsConfigZonalClient) UpdateOSPolicyAssignmentOperation added in v1.2.0

func (c *OsConfigZonalClient) UpdateOSPolicyAssignmentOperation(name string) *UpdateOSPolicyAssignmentOperation

UpdateOSPolicyAssignmentOperation returns a new UpdateOSPolicyAssignmentOperation from a given name. The name must be that of a previously created UpdateOSPolicyAssignmentOperation, possibly from a different process.

type PatchDeploymentIterator

type PatchDeploymentIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.PatchDeployment, nextPageToken string, err error)
	// contains filtered or unexported fields
}

PatchDeploymentIterator manages a stream of *osconfigpb.PatchDeployment.

func (*PatchDeploymentIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*PatchDeploymentIterator) PageInfo

func (it *PatchDeploymentIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type PatchJobInstanceDetailsIterator

type PatchJobInstanceDetailsIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.PatchJobInstanceDetails, nextPageToken string, err error)
	// contains filtered or unexported fields
}

PatchJobInstanceDetailsIterator manages a stream of *osconfigpb.PatchJobInstanceDetails.

func (*PatchJobInstanceDetailsIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*PatchJobInstanceDetailsIterator) PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type PatchJobIterator

type PatchJobIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.PatchJob, nextPageToken string, err error)
	// contains filtered or unexported fields
}

PatchJobIterator manages a stream of *osconfigpb.PatchJob.

func (*PatchJobIterator) Next

func (it *PatchJobIterator) Next() (*osconfigpb.PatchJob, error)

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*PatchJobIterator) PageInfo

func (it *PatchJobIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

type UpdateOSPolicyAssignmentOperation added in v1.2.0

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

UpdateOSPolicyAssignmentOperation manages a long-running operation from UpdateOSPolicyAssignment.

func (*UpdateOSPolicyAssignmentOperation) Done added in v1.2.0

Done reports whether the long-running operation has completed.

func (*UpdateOSPolicyAssignmentOperation) Metadata added in v1.2.0

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UpdateOSPolicyAssignmentOperation) Name added in v1.2.0

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UpdateOSPolicyAssignmentOperation) Poll added in v1.2.0

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UpdateOSPolicyAssignmentOperation) Wait added in v1.2.0

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

type VulnerabilityReportIterator added in v0.2.0

type VulnerabilityReportIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*osconfigpb.VulnerabilityReport, nextPageToken string, err error)
	// contains filtered or unexported fields
}

VulnerabilityReportIterator manages a stream of *osconfigpb.VulnerabilityReport.

func (*VulnerabilityReportIterator) Next added in v0.2.0

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*VulnerabilityReportIterator) PageInfo added in v0.2.0

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL