Documentation ¶
Overview ¶
Copyright 2023 Google LLC. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package unstructured provides a generic unstructured client to invoke DCL.
Index ¶
- Variables
- func Delete(ctx context.Context, config *dcl.Config, r *Resource) error
- func DeletePolicyMember(ctx context.Context, config *dcl.Config, r *Resource, m *Resource) error
- func HasDiff(ctx context.Context, config *dcl.Config, r *Resource, opts ...dcl.ApplyOption) (bool, error)
- func ID(r *Resource) (string, error)
- func Register(rr RegisteredResource)
- func WithStateHint(r *Resource) dcl.ApplyOption
- type RegisteredResource
- type Resource
- func Apply(ctx context.Context, config *dcl.Config, r *Resource, opts ...dcl.ApplyOption) (*Resource, error)
- func FetchStateHint(c []dcl.ApplyOption) *Resource
- func Get(ctx context.Context, config *dcl.Config, r *Resource) (*Resource, error)
- func GetPolicy(ctx context.Context, config *dcl.Config, r *Resource) (*Resource, error)
- func GetPolicyMember(ctx context.Context, config *dcl.Config, r *Resource, role, member string) (*Resource, error)
- func SetPolicy(ctx context.Context, config *dcl.Config, r *Resource, p *Resource) (*Resource, error)
- func SetPolicyMember(ctx context.Context, config *dcl.Config, r *Resource, m *Resource) (*Resource, error)
- func SetPolicyWithEtag(ctx context.Context, config *dcl.Config, r *Resource, p *Resource) (*Resource, error)
- type ServiceTypeVersion
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchMethod is the error returned when calling Get, List, Apply, or Delete // on an API that doesn't support the requested method. ErrNoSuchMethod = errors.New("non-existent API method") )
Functions ¶
func DeletePolicyMember ¶ added in v1.1.0
DeletePolicyMember deletes the IAMPolicyMember for the provided resource.
func HasDiff ¶
func HasDiff(ctx context.Context, config *dcl.Config, r *Resource, opts ...dcl.ApplyOption) (bool, error)
HasDiff returns whether the provided resource config matches the live resource, i.e., a return value of true indicates that calling Apply() will cause a creation or update of the live resource. The `opts` parameter can optionally include a state hint.
func Register ¶
func Register(rr RegisteredResource)
Register adds the provided resource to the list of resources available via the generic Get/List/Apply/Delete functions.
func WithStateHint ¶
func WithStateHint(r *Resource) dcl.ApplyOption
WithStateHint performs the same function as dcl.WithStateHint, but takes an unstructured resource.
Types ¶
type RegisteredResource ¶
type RegisteredResource interface { // STV indicates the type of this resource. STV() ServiceTypeVersion // Get provides an indirection for the type-specific Get call. Get(ctx context.Context, config *dcl.Config, r *Resource) (*Resource, error) // Apply provides an indirection for the type-specific Apply call. Apply(ctx context.Context, config *dcl.Config, r *Resource, opts ...dcl.ApplyOption) (*Resource, error) // HasDiff provides an indirection for the type-specific HasDiff call. HasDiff(ctx context.Context, config *dcl.Config, r *Resource, opts ...dcl.ApplyOption) (bool, error) // Delete provides an indirection for the type-specific Delete call. Delete(ctx context.Context, config *dcl.Config, r *Resource) error // GetPolicy provides an indirection for the type-specific GetPolicy call. GetPolicy(ctx context.Context, config *dcl.Config, r *Resource) (*Resource, error) // SetPolicy provides an indirection for the type-specific SetPolicy call. SetPolicy(ctx context.Context, config *dcl.Config, r *Resource, p *Resource) (*Resource, error) // SetPolicyWithEtag provides an indirection for the type-specific SetPolicy call. SetPolicyWithEtag(ctx context.Context, config *dcl.Config, r *Resource, p *Resource) (*Resource, error) // GetPolicyMember provides an indirection for the type-specific GetPolicyMember call. GetPolicyMember(ctx context.Context, config *dcl.Config, r *Resource, role, member string) (*Resource, error) // SetPolicyMember provides an indirection for the type-specific SetPolicyMember call. SetPolicyMember(ctx context.Context, config *dcl.Config, r *Resource, m *Resource) (*Resource, error) // DeletePolicyMember provides an indirection for the type-specific DeletePolicyMember call. DeletePolicyMember(ctx context.Context, config *dcl.Config, r *Resource, m *Resource) error // ID returns a string uniquely identifying this resource. ID(r *Resource) (string, error) }
RegisteredResource is used by generated unstructured library code to make type-specific operations available in a type-agnostic manner.
type Resource ¶
type Resource struct { // ResourceWithPolicy is included so that the Resource struct can interact with the // IAMClient (IAMClient methods expect a ResourceWithPolicy) iam.ResourceWithPolicy // Object is a JSON compatible map with string, float, int, // bool, []interface{}, or map[string]interface{} children. Object map[string]interface{} // STV indicates the type of this resource STV ServiceTypeVersion }
Resource is the untyped representation of a typed DCL resource.
func Apply ¶
func Apply(ctx context.Context, config *dcl.Config, r *Resource, opts ...dcl.ApplyOption) (*Resource, error)
Apply creates or updates the provided resource.
func FetchStateHint ¶
func FetchStateHint(c []dcl.ApplyOption) *Resource
FetchStateHint returns either nil or a Resource representing the pre-apply state.
func Get ¶
Get returns the current version of a given resource (usually from the result of a previous Apply()).
func GetPolicyMember ¶
func GetPolicyMember(ctx context.Context, config *dcl.Config, r *Resource, role, member string) (*Resource, error)
GetPolicyMember gets the IAMPolicyMember for the provided resource.
func SetPolicy ¶
func SetPolicy(ctx context.Context, config *dcl.Config, r *Resource, p *Resource) (*Resource, error)
SetPolicy sets the IAMPolicy for the provided resource.
type ServiceTypeVersion ¶
type ServiceTypeVersion struct { // Service to which this resource belongs, e.g., "compute". Service string // Type of the resource, e.g., "ComputeInstance" Type string // Version of the resource, e.g., "ga". There may be multiple versions of the // same Type and Service in a single DCL build. Version string }
ServiceTypeVersion describes a single DCL resource.
func (ServiceTypeVersion) Equals ¶
func (stv ServiceTypeVersion) Equals(o ServiceTypeVersion) bool
Equals compares two ServiceTypeVersion structures.
func (ServiceTypeVersion) String ¶
func (stv ServiceTypeVersion) String() string
String returns a loggable description of this ServiceTypeVersion.