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.
NOTE : This package is in alpha . It is not stable , and is likely to change .
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview . Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/osconfig/apiv1alpha@latest ctx := context . Background () // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in: // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options c , err := osconfig . NewOsConfigZonalClient ( 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, mentioned above.
req := & osconfigpb . CreateOSPolicyAssignmentRequest { // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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
Use of Context
The ctx passed to NewOsConfigZonalClient 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.
Functions
func DefaultAuthScopes
  func 
  
 DefaultAuthScopes 
 () 
  
 [] 
  string 
 
 
 
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
CreateOSPolicyAssignmentOperation
  type 
  
 CreateOSPolicyAssignmentOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 
 
CreateOSPolicyAssignmentOperation manages a long-running operation from CreateOSPolicyAssignment.
func (*CreateOSPolicyAssignmentOperation) Done
  func 
  
 ( 
 op 
  
 * 
  CreateOSPolicyAssignmentOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 
 
Done reports whether the long-running operation has completed.
func (*CreateOSPolicyAssignmentOperation) Metadata
  func 
  
 ( 
 op 
  
 * 
  CreateOSPolicyAssignmentOperation 
 
 ) 
  
 Metadata 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignmentOperationMetadata 
 
 , 
  
  error 
 
 ) 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  CreateOSPolicyAssignmentOperation 
 
 ) 
  
 Name 
 () 
  
  string 
 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  CreateOSPolicyAssignmentOperation 
 
 ) 
  
 Poll 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignment 
 
 , 
  
  error 
 
 ) 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  CreateOSPolicyAssignmentOperation 
 
 ) 
  
 Wait 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignment 
 
 , 
  
  error 
 
 ) 
 
 
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteOSPolicyAssignmentOperation
  type 
  
 DeleteOSPolicyAssignmentOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 
 
DeleteOSPolicyAssignmentOperation manages a long-running operation from DeleteOSPolicyAssignment.
func (*DeleteOSPolicyAssignmentOperation) Done
  func 
  
 ( 
 op 
  
 * 
  DeleteOSPolicyAssignmentOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 
 
Done reports whether the long-running operation has completed.
func (*DeleteOSPolicyAssignmentOperation) Metadata
  func 
  
 ( 
 op 
  
 * 
  DeleteOSPolicyAssignmentOperation 
 
 ) 
  
 Metadata 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignmentOperationMetadata 
 
 , 
  
  error 
 
 ) 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  DeleteOSPolicyAssignmentOperation 
 
 ) 
  
 Name 
 () 
  
  string 
 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  DeleteOSPolicyAssignmentOperation 
 
 ) 
  
 Poll 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
  error 
 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  DeleteOSPolicyAssignmentOperation 
 
 ) 
  
 Wait 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
  error 
 
 
 
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
InstanceOSPoliciesComplianceIterator
  type 
  
 InstanceOSPoliciesComplianceIterator 
  
 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 
 
 . 
  InstanceOSPoliciesCompliance 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 
 
InstanceOSPoliciesComplianceIterator manages a stream of *osconfigpb.InstanceOSPoliciesCompliance.
func (*InstanceOSPoliciesComplianceIterator) All
  func 
  
 ( 
 it 
  
 * 
  InstanceOSPoliciesComplianceIterator 
 
 ) 
  
 All 
 () 
  
 iter 
 . 
 Seq2 
 [ 
 * 
 osconfigpb 
 . 
 InstanceOSPoliciesCompliance 
 , 
  
 error 
 ] 
 
 
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*InstanceOSPoliciesComplianceIterator) Next
  func 
  
 ( 
 it 
  
 * 
  InstanceOSPoliciesComplianceIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  InstanceOSPoliciesCompliance 
 
 , 
  
  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 (*InstanceOSPoliciesComplianceIterator) PageInfo
  func 
  
 ( 
 it 
  
 * 
  InstanceOSPoliciesComplianceIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 
 
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
InventoryIterator
  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) All
  func 
  
 ( 
 it 
  
 * 
  InventoryIterator 
 
 ) 
  
 All 
 () 
  
 iter 
 . 
 Seq2 
 [ 
 * 
 osconfigpb 
 . 
 Inventory 
 , 
  
 error 
 ] 
 
 
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*InventoryIterator) Next
  func 
  
 ( 
 it 
  
 * 
  InventoryIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  Inventory 
 
 , 
  
  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 (*InventoryIterator) PageInfo
  func 
  
 ( 
 it 
  
 * 
  InventoryIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 
 
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OSPolicyAssignmentIterator
  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) All
  func 
  
 ( 
 it 
  
 * 
  OSPolicyAssignmentIterator 
 
 ) 
  
 All 
 () 
  
 iter 
 . 
 Seq2 
 [ 
 * 
 osconfigpb 
 . 
 OSPolicyAssignment 
 , 
  
 error 
 ] 
 
 
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OSPolicyAssignmentIterator) Next
  func 
  
 ( 
 it 
  
 * 
  OSPolicyAssignmentIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignment 
 
 , 
  
  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 (*OSPolicyAssignmentIterator) PageInfo
  func 
  
 ( 
 it 
  
 * 
  OSPolicyAssignmentIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 
 
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OSPolicyAssignmentReportIterator
  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) All
  func 
  
 ( 
 it 
  
 * 
  OSPolicyAssignmentReportIterator 
 
 ) 
  
 All 
 () 
  
 iter 
 . 
 Seq2 
 [ 
 * 
 osconfigpb 
 . 
 OSPolicyAssignmentReport 
 , 
  
 error 
 ] 
 
 
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OSPolicyAssignmentReportIterator) Next
  func 
  
 ( 
 it 
  
 * 
  OSPolicyAssignmentReportIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignmentReport 
 
 , 
  
  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 (*OSPolicyAssignmentReportIterator) PageInfo
  func 
  
 ( 
 it 
  
 * 
  OSPolicyAssignmentReportIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 
 
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OsConfigZonalCallOptions
  type 
  
 OsConfigZonalCallOptions 
  
 struct 
  
 { 
  
 CreateOSPolicyAssignment 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdateOSPolicyAssignment 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetOSPolicyAssignment 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListOSPolicyAssignments 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListOSPolicyAssignmentRevisions 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeleteOSPolicyAssignment 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetInstanceOSPoliciesCompliance 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 ListInstanceOSPoliciesCompliances 
  
 [] 
  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.
OsConfigZonalClient
  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
  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/apiv1alpha" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 osconfig 
 . 
  NewOsConfigZonalClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 
 
func NewOsConfigZonalRESTClient
  func 
  
 NewOsConfigZonalRESTClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
 option 
 . 
 ClientOption 
 ) 
  
 ( 
 * 
  OsConfigZonalClient 
 
 , 
  
  error 
 
 ) 
 
 
NewOsConfigZonalRESTClient creates a new os config zonal service rest client.
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/apiv1alpha" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 osconfig 
 . 
  NewOsConfigZonalRESTClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 
 
func (*OsConfigZonalClient) Close
  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 (deprecated)
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 Connection 
 () 
  
 * 
 grpc 
 . 
 ClientConn 
 
 
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*OsConfigZonalClient) CreateOSPolicyAssignment
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 CreateOSPolicyAssignment 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  CreateOSPolicyAssignmentRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  CreateOSPolicyAssignmentOperation 
 
 , 
  
  error 
 
 ) 
 
 
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/v1alpha/projects.locations.osPolicyAssignments.operations/cancel ).
Example
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
 } 
 
 
func (*OsConfigZonalClient) CreateOSPolicyAssignmentOperation
  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
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 DeleteOSPolicyAssignment 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  DeleteOSPolicyAssignmentRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  DeleteOSPolicyAssignmentOperation 
 
 , 
  
  error 
 
 ) 
 
 
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/v1alpha/projects.locations.osPolicyAssignments.operations/cancel ).
Example
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#DeleteOSPolicyAssignmentRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 DeleteOSPolicyAssignment 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 err 
  
 = 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) DeleteOSPolicyAssignmentOperation
  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) GetInstanceOSPoliciesCompliance (deprecated)
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 GetInstanceOSPoliciesCompliance 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  GetInstanceOSPoliciesComplianceRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  InstanceOSPoliciesCompliance 
 
 , 
  
  error 
 
 ) 
 
 
GetInstanceOSPoliciesCompliance get OS policies compliance data for the specified Compute Engine VM instance.
Deprecated: GetInstanceOSPoliciesCompliance may be removed in a future version.
Example
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 osconfig 
 . 
  NewOsConfigZonalClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& osconfigpb 
 . 
 GetInstanceOSPoliciesComplianceRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#GetInstanceOSPoliciesComplianceRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetInstanceOSPoliciesCompliance 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 
 
func (*OsConfigZonalClient) GetInventory
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 GetInventory 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  GetInventoryRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  Inventory 
 
 , 
  
  error 
 
 ) 
 
 
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/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#GetInventoryRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetInventory 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 
 
func (*OsConfigZonalClient) GetOSPolicyAssignment
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 GetOSPolicyAssignment 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  GetOSPolicyAssignmentRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignment 
 
 , 
  
  error 
 
 ) 
 
 
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/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#GetOSPolicyAssignmentRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetOSPolicyAssignment 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 
 
func (*OsConfigZonalClient) GetOSPolicyAssignmentReport
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 GetOSPolicyAssignmentReport 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  GetOSPolicyAssignmentReportRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignmentReport 
 
 , 
  
  error 
 
 ) 
 
 
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/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#GetOSPolicyAssignmentReportRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetOSPolicyAssignmentReport 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 
 
func (*OsConfigZonalClient) GetVulnerabilityReport
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 GetVulnerabilityReport 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  GetVulnerabilityReportRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  VulnerabilityReport 
 
 , 
  
  error 
 
 ) 
 
 
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/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#GetVulnerabilityReportRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetVulnerabilityReport 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 
 
func (*OsConfigZonalClient) ListInstanceOSPoliciesCompliances (deprecated)
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 ListInstanceOSPoliciesCompliances 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  ListInstanceOSPoliciesCompliancesRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 * 
  InstanceOSPoliciesComplianceIterator 
 
 
 
ListInstanceOSPoliciesCompliances list OS policies compliance data for all Compute Engine VM instances in the specified zone.
Deprecated: ListInstanceOSPoliciesCompliances may be removed in a future version.
Examples
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 osconfig 
 . 
  NewOsConfigZonalClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& osconfigpb 
 . 
 ListInstanceOSPoliciesCompliancesRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListInstanceOSPoliciesCompliancesRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListInstanceOSPoliciesCompliances 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 osconfigpb 
 . 
 ListInstanceOSPoliciesCompliancesResponse 
 ) 
  
 } 
 } 
 
 
all
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 osconfig 
 . 
  NewOsConfigZonalClient 
 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& osconfigpb 
 . 
 ListInstanceOSPoliciesCompliancesRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListInstanceOSPoliciesCompliancesRequest. 
  
 } 
  
 for 
  
 resp 
 , 
  
 err 
  
 := 
  
 range 
  
 c 
 . 
 ListInstanceOSPoliciesCompliances 
 ( 
 ctx 
 , 
  
 req 
 ). 
 All 
 () 
  
 { 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error and break/return/continue. Iteration will stop after any error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) ListInventories
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 ListInventories 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  ListInventoriesRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 * 
  InventoryIterator 
 
 
 
ListInventories list inventory data for all VM instances in the specified zone.
Examples
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 osconfigpb 
 . 
 ListInventoriesResponse 
 ) 
  
 } 
 } 
 
 
all
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListInventoriesRequest. 
  
 } 
  
 for 
  
 resp 
 , 
  
 err 
  
 := 
  
 range 
  
 c 
 . 
 ListInventories 
 ( 
 ctx 
 , 
  
 req 
 ). 
 All 
 () 
  
 { 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error and break/return/continue. Iteration will stop after any error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) ListOSPolicyAssignmentReports
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 ListOSPolicyAssignmentReports 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  ListOSPolicyAssignmentReportsRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 * 
  OSPolicyAssignmentReportIterator 
 
 
 
ListOSPolicyAssignmentReports list OS policy asssignment reports for all Compute Engine VM instances in the specified zone.
Examples
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 osconfigpb 
 . 
 ListOSPolicyAssignmentReportsResponse 
 ) 
  
 } 
 } 
 
 
all
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListOSPolicyAssignmentReportsRequest. 
  
 } 
  
 for 
  
 resp 
 , 
  
 err 
  
 := 
  
 range 
  
 c 
 . 
 ListOSPolicyAssignmentReports 
 ( 
 ctx 
 , 
  
 req 
 ). 
 All 
 () 
  
 { 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error and break/return/continue. Iteration will stop after any error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) ListOSPolicyAssignmentRevisions
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 ListOSPolicyAssignmentRevisions 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  ListOSPolicyAssignmentRevisionsRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 * 
  OSPolicyAssignmentIterator 
 
 
 
ListOSPolicyAssignmentRevisions list the OS policy assignment revisions for a given OS policy assignment.
Examples
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 osconfigpb 
 . 
 ListOSPolicyAssignmentRevisionsResponse 
 ) 
  
 } 
 } 
 
 
all
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListOSPolicyAssignmentRevisionsRequest. 
  
 } 
  
 for 
  
 resp 
 , 
  
 err 
  
 := 
  
 range 
  
 c 
 . 
 ListOSPolicyAssignmentRevisions 
 ( 
 ctx 
 , 
  
 req 
 ). 
 All 
 () 
  
 { 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error and break/return/continue. Iteration will stop after any error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) ListOSPolicyAssignments
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 ListOSPolicyAssignments 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  ListOSPolicyAssignmentsRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 * 
  OSPolicyAssignmentIterator 
 
 
 
ListOSPolicyAssignments list the OS policy assignments under the parent resource.
For each OS policy assignment, the latest revision is returned.
Examples
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 osconfigpb 
 . 
 ListOSPolicyAssignmentsResponse 
 ) 
  
 } 
 } 
 
 
all
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListOSPolicyAssignmentsRequest. 
  
 } 
  
 for 
  
 resp 
 , 
  
 err 
  
 := 
  
 range 
  
 c 
 . 
 ListOSPolicyAssignments 
 ( 
 ctx 
 , 
  
 req 
 ). 
 All 
 () 
  
 { 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error and break/return/continue. Iteration will stop after any error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) ListVulnerabilityReports
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 ListVulnerabilityReports 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  ListVulnerabilityReportsRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 * 
  VulnerabilityReportIterator 
 
 
 
ListVulnerabilityReports list vulnerability reports for all VM instances in the specified zone.
Examples
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
  
 "google.golang.org/api/iterator" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
  
 // If you need to access the underlying RPC response, 
  
 // you can do so by casting the `Response` as below. 
  
 // Otherwise, remove this line. Only populated after 
  
 // first call to Next(). Not safe for concurrent access. 
  
 _ 
  
 = 
  
 it 
 . 
 Response 
 .( 
 * 
 osconfigpb 
 . 
 ListVulnerabilityReportsResponse 
 ) 
  
 } 
 } 
 
 
all
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#ListVulnerabilityReportsRequest. 
  
 } 
  
 for 
  
 resp 
 , 
  
 err 
  
 := 
  
 range 
  
 c 
 . 
 ListVulnerabilityReports 
 ( 
 ctx 
 , 
  
 req 
 ). 
 All 
 () 
  
 { 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error and break/return/continue. Iteration will stop after any error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 
 
func (*OsConfigZonalClient) UpdateOSPolicyAssignment
  func 
  
 ( 
 c 
  
 * 
  OsConfigZonalClient 
 
 ) 
  
 UpdateOSPolicyAssignment 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 req 
  
 * 
  osconfigpb 
 
 . 
  UpdateOSPolicyAssignmentRequest 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  UpdateOSPolicyAssignmentOperation 
 
 , 
  
  error 
 
 ) 
 
 
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/v1alpha/projects.locations.osPolicyAssignments.operations/cancel ).
Example
  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 osconfig 
  
 "cloud.google.com/go/osconfig/apiv1alpha" 
  
 osconfigpb 
  
 "cloud.google.com/go/osconfig/apiv1alpha/osconfigpb" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 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/cloud.google.com/go/osconfig/apiv1alpha/osconfigpb#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 
 } 
 
 
func (*OsConfigZonalClient) UpdateOSPolicyAssignmentOperation
  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.
UpdateOSPolicyAssignmentOperation
  type 
  
 UpdateOSPolicyAssignmentOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 
 
UpdateOSPolicyAssignmentOperation manages a long-running operation from UpdateOSPolicyAssignment.
func (*UpdateOSPolicyAssignmentOperation) Done
  func 
  
 ( 
 op 
  
 * 
  UpdateOSPolicyAssignmentOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 
 
Done reports whether the long-running operation has completed.
func (*UpdateOSPolicyAssignmentOperation) Metadata
  func 
  
 ( 
 op 
  
 * 
  UpdateOSPolicyAssignmentOperation 
 
 ) 
  
 Metadata 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignmentOperationMetadata 
 
 , 
  
  error 
 
 ) 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  UpdateOSPolicyAssignmentOperation 
 
 ) 
  
 Name 
 () 
  
  string 
 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  UpdateOSPolicyAssignmentOperation 
 
 ) 
  
 Poll 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignment 
 
 , 
  
  error 
 
 ) 
 
 
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
  func 
  
 ( 
 op 
  
 * 
  UpdateOSPolicyAssignmentOperation 
 
 ) 
  
 Wait 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  gax 
 
 . 
  CallOption 
 
 ) 
  
 ( 
 * 
  osconfigpb 
 
 . 
  OSPolicyAssignment 
 
 , 
  
  error 
 
 ) 
 
 
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
VulnerabilityReportIterator
  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) All
  func 
  
 ( 
 it 
  
 * 
  VulnerabilityReportIterator 
 
 ) 
  
 All 
 () 
  
 iter 
 . 
 Seq2 
 [ 
 * 
 osconfigpb 
 . 
 VulnerabilityReport 
 , 
  
 error 
 ] 
 
 
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*VulnerabilityReportIterator) Next
  func 
  
 ( 
 it 
  
 * 
  VulnerabilityReportIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  osconfigpb 
 
 . 
  VulnerabilityReport 
 
 , 
  
  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 (*VulnerabilityReportIterator) PageInfo
  func 
  
 ( 
 it 
  
 * 
  VulnerabilityReportIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
 iterator 
 . 
 PageInfo 
 
 
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.

