Class BaseOperation<T extends io.fabric8.kubernetes.api.model.HasMetadata,​L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>,​R extends Resource<T>>

    • Field Detail

      • apiVersion

        protected String apiVersion
      • type

        protected Class<T extends io.fabric8.kubernetes.api.model.HasMetadata> type
      • listType

        protected Class<L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>> listType
    • Method Detail

      • get

        public T get()
        Specified by:
        get in interface Gettable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Returns:
        the item or null if the item doesn't exist.
      • require

        public T require()
        Specified by:
        require in interface Requirable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Returns:
        the item or throws an exception if the item doesn't exist.
      • getMandatory

        public T getMandatory()
      • getRootPaths

        public io.fabric8.kubernetes.api.model.RootPaths getRootPaths()
      • edit

        public T edit​(UnaryOperator<T> function)
        Specified by:
        edit in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • edit

        public T edit​(io.fabric8.kubernetes.api.builder.Visitor... visitors)
        Specified by:
        edit in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • edit

        public <V> T edit​(Class<V> visitorType,
                          io.fabric8.kubernetes.api.builder.Visitor<V> visitor)
        Specified by:
        edit in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • accept

        public T accept​(Consumer<T> consumer)
        Specified by:
        accept in interface Editable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • withName

        public R withName​(String name)
        Specified by:
        withName in interface Nameable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • cascading

        public EditReplacePatchDeletable<T> cascading​(boolean cascading)
        Description copied from interface: Cascading
        deletes dependent resources. Sets `orphanDependents` field to `false` when set `true`
        Specified by:
        cascading in interface Cascading<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        cascading - whether dependents should be orphaned or not.
        Returns:
        resource
      • load

        public R load​(InputStream is)
        Description copied from interface: Loadable
        Load from an InputStream.
        Specified by:
        load in interface Loadable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        is - The input stream.
        Returns:
        returns de-serialized object
      • load

        public R load​(URL url)
        Description copied from interface: Loadable
        Load from a URL.
        Specified by:
        load in interface Loadable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        url - The url.
        Returns:
        returns de-serialized object
      • load

        public R load​(File file)
        Description copied from interface: Loadable
        Load from a File.
        Specified by:
        load in interface Loadable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        file - The file.
        Returns:
        returns de-serialized object
      • load

        public R load​(String path)
        Description copied from interface: Loadable
        Load from path.
        Specified by:
        load in interface Loadable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        path - The path.
        Returns:
        returns de-serialized object
      • create

        @SafeVarargs
        public final T create​(T... resources)
        Specified by:
        create in interface Createable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • create

        public T create​(T resource)
        Specified by:
        create in interface Createable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • createOrReplace

        @SafeVarargs
        public final T createOrReplace​(T... items)
        Description copied from interface: CreateOrReplaceable
        Creates a provided resource in a Kubernetes Cluster. If creation fails with a HTTP_CONFLICT, it tries to replace resource.
        Specified by:
        createOrReplace in interface CreateOrReplaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        items - item to create or replace
        Returns:
        created item returned in kubernetes api response
      • withoutLabels

        @Deprecated
        public FilterWatchListDeletable<T,​L> withoutLabels​(Map<String,​String> labels)
        Deprecated.
        as the underlying implementation does not align with the arguments anymore. It is possible to negate multiple values with the same key, e.g.: foo != bar , foo != baz To support this a multi-value map is needed, as a regular map would override the key with the new value.
        Specified by:
        withoutLabels in interface Filterable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • withInvolvedObject

        public FilterWatchListDeletable<T,​L> withInvolvedObject​(io.fabric8.kubernetes.api.model.ObjectReference objectReference)
        Description copied from interface: Filterable
        Filter with the object that this event is about.
        Specified by:
        withInvolvedObject in interface Filterable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        objectReference - ObjectReference for providing information of referred object
        Returns:
        filtered resource
      • withoutFields

        @Deprecated
        public FilterWatchListDeletable<T,​L> withoutFields​(Map<String,​String> fields)
        Deprecated.
        as the underlying implementation does not align with the arguments fully. Method is created to have a similar API as `withoutLabels`, but should eventually be replaced with something better for the same reasons. It is possible to negate multiple values with the same key, e.g.: foo != bar , foo != baz To support this a multi-value map is needed, as a regular map would override the key with the new value.
        Specified by:
        withoutFields in interface Filterable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • getLabelQueryParam

        public String getLabelQueryParam()
      • getFieldQueryParam

        public String getFieldQueryParam()
      • list

        public L list()
        Specified by:
        list in interface Listable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • list

        public L list​(Integer limitVal,
                      String continueVal)
        Description copied from interface: Listable
        List resources from APIServer.
        Specified by:
        list in interface Listable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        limitVal - number of resources to list
        continueVal - an offset to pick listing from
        Returns:
        resource list
      • list

        public L list​(io.fabric8.kubernetes.api.model.ListOptions listOptions)
        Description copied from interface: Listable
        List resource from Kubernetes API server.
        Specified by:
        list in interface Listable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        listOptions - ListOptions is the query options to a standard REST list call.
        Returns:
        list of resource type
      • delete

        public Boolean delete()
        Description copied from interface: Deletable
        Deletes resource and all managed resources, returns null or false if not found.
        Specified by:
        delete in interface Deletable
        Returns:
        value indicating object was deleted or not
      • updateStatus

        public T updateStatus​(T item)
        Description copied from interface: StatusUpdatable
        When the status subresource is enabled, the /status subresource for the custom resource is exposed. It does a PUT requests to the /status subresource take a resource object and ignore changes to anything except the status stanza.
        Specified by:
        updateStatus in interface StatusUpdatable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        item - kubernetes object
        Returns:
        updated object
      • withResourceVersion

        public R withResourceVersion​(String resourceVersion)
        Specified by:
        withResourceVersion in interface Versionable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • watch

        public Watch watch​(Watcher<T> watcher)
        Description copied from interface: Watchable
        Watch returns Watch interface that watches requested resource
        Specified by:
        watch in interface Watchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        watcher - Watcher interface of Kubernetes resource
        Returns:
        watch interface Watch
      • watch

        public Watch watch​(String resourceVersion,
                           Watcher<T> watcher)
        Description copied from interface: Watchable
        Watch returns Watch interface that watches requested resource from specified resourceVersion
        Specified by:
        watch in interface Watchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        resourceVersion - resource version from where to start watch
        watcher - Watcher interface of Kubernetes resource
        Returns:
        watch interface Watch
      • watch

        public Watch watch​(io.fabric8.kubernetes.api.model.ListOptions options,
                           Watcher<T> watcher)
        Description copied from interface: Watchable
        Watch returns Watch interface that watches requested resource
        Specified by:
        watch in interface Watchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        options - options available for watch operation
        watcher - Watcher interface of Kubernetes resource
        Returns:
        watch interface Watch
      • replace

        public T replace​(T item)
        Specified by:
        replace in interface Replaceable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • patch

        public T patch​(T item)
        Specified by:
        patch in interface Patchable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
      • sendPatchedObject

        protected T sendPatchedObject​(T oldObject,
                                      T updatedObject)
      • handleScale

        protected io.fabric8.kubernetes.api.model.autoscaling.v1.Scale handleScale​(io.fabric8.kubernetes.api.model.autoscaling.v1.Scale scaleParam)
      • handleDeploymentRollback

        protected io.fabric8.kubernetes.api.model.Status handleDeploymentRollback​(io.fabric8.kubernetes.api.model.extensions.DeploymentRollback deploymentRollback)
      • isCascading

        public Boolean isCascading()
      • getItem

        public T getItem()
      • getResourceVersion

        public String getResourceVersion()
      • isReloadingFromServer

        public Boolean isReloadingFromServer()
      • getGracePeriodSeconds

        public Long getGracePeriodSeconds()
      • getPropagationPolicy

        public io.fabric8.kubernetes.api.model.DeletionPropagation getPropagationPolicy()
      • getType

        public Class<T> getType()
      • getListType

        public Class<L> getListType()
      • withGracePeriod

        public FilterWatchListDeletable<T,​L> withGracePeriod​(long gracePeriodSeconds)
        Description copied from interface: GracePeriodConfigurable
        The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
        Specified by:
        withGracePeriod in interface GracePeriodConfigurable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        gracePeriodSeconds - grace period integer value in seconds
        Returns:
        the object for which grace period is configured
      • withPropagationPolicy

        public EditReplacePatchDeletable<T> withPropagationPolicy​(io.fabric8.kubernetes.api.model.DeletionPropagation propagationPolicy)
        Description copied from interface: PropagationPolicyConfigurable
        Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both.

        The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy.

        Acceptable values are:
        'Orphan' - orphan the dependents;
        'Background' - allow the garbage collector to delete the dependents in the background;
        'Foreground' - a cascading policy that deletes all dependents in the foreground.

        Specified by:
        withPropagationPolicy in interface PropagationPolicyConfigurable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        propagationPolicy - propagation policy in form of string DeletionPropagation
        Returns:
        resource
      • withWaitRetryBackoff

        public BaseOperation<T,​L,​R> withWaitRetryBackoff​(long initialBackoff,
                                                                     TimeUnit backoffUnit,
                                                                     double backoffMultiplier)
        Description copied from interface: Waitable
        Configure the backoff strategy to use when waiting for conditions, in case the watcher encounters a retryable error.
        Specified by:
        withWaitRetryBackoff in interface Waitable<T extends io.fabric8.kubernetes.api.model.HasMetadata,​L extends io.fabric8.kubernetes.api.model.KubernetesResourceList<T>>
        Parameters:
        initialBackoff - the value for the initial backoff on first error
        backoffUnit - the TimeUnit for the initial backoff value
        backoffMultiplier - what to multiply the backoff by on each subsequent error
        Returns:
        the waitable
      • getConfigType

        protected Class<? extends Config> getConfigType()
      • updateApiVersion

        protected void updateApiVersion​(io.fabric8.kubernetes.api.model.KubernetesResourceList<T> list)
        Updates the list items if they have missing or default apiGroupVersion values and the resource is currently using API Groups with custom version strings
        Parameters:
        list - Kubernetes resource list
      • updateApiVersion

        protected void updateApiVersion​(io.fabric8.kubernetes.api.model.HasMetadata hasMetadata)
        Updates the resource if it has missing or default apiGroupVersion values and the resource is currently using API Groups with custom version strings
        Parameters:
        hasMetadata - object whose api version needs to be updated
      • getApiVersion

        public String getApiVersion()
      • isApiGroup

        public boolean isApiGroup()
        Return true if this is an API Group where the versions include a slash in them
        Returns:
        boolean value indicating whether API group or not
      • getReadiness

        public Readiness getReadiness()
      • setType

        public void setType​(Class<T> type)
      • setListType

        public void setListType​(Class<L> listType)
      • setNamespace

        public void setNamespace​(String namespace)
      • dryRun

        public WritableOperation<T> dryRun​(boolean isDryRun)
        Description copied from interface: DryRunable
        Indicates whether modifications should not be persisted or not. If enabled, All dry run stages will be processed. the request is still processed as typical request: the fields are defaulted, the object is validated, it goes through the validation admission chain, and through the mutating admission chain, and then the final object is returned to the user as it normally would, without being persisted.
        Specified by:
        dryRun in interface DryRunable<T extends io.fabric8.kubernetes.api.model.HasMetadata>
        Parameters:
        isDryRun - whether dry run is enabled or disabled
        Returns:
        write operations which are applicable for dry run