Skip to content

Get without exception #109

Open
Open
@kke

Description

@kke

It would be nice to have exceptionless version of get(and maybe for put/patch etc?):

def cluster_id 
  client.api('v1')
    .resource('configmaps', namespace: 'kube-public')
    .get('cluster-info')
    .metadata
    .uid
rescue K8s::Error::NotFound
  nil
end

vs:

def cluster_id
  client.api('v1')
     .resource('configmaps', namespace: 'kube-public')
     .get!('cluster-info')&.metadata&.uid
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions